Classes & Objects
- Pick out the other definition of objects.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
instance of the class
- How many objects can present in a single class?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Because a class may contain any number of objects according to its compliance.
- What will happen when introduce the interface of classes in a run-time polymorphic hierarchy?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Separation of interface from implementation
- How many types of inheritance are there in c++?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
There are five types of inheritance in c++. They are single, Multiple, Hierarchical, Multilevel, Hybrid.
- What is the output of this program?
#include <iostream>
using namespace std;
class student
{
protected:
int Rollno;
public:
void get_Rollno(int num)
{
Rollno = num;
}
void put_Rollno(void)
{
}
};
class test:public student
{
protected:
float Subject1,Subject2;
public:
void get_mark(float num1, float num2)
{
Subject1 = num1;
Subject2 = num2;
}
void put_marks()
{
}
};
class sports
{
protected:
float score;
public:
void getscore(float s)
{
score = s;
}
void putscore(void)
{
}
};
class result: public test, public sports
{
float total;
public:
void display(void);
};
void result::display(void)
{
total = Subject1 + Subject2 + score;
put_Rollno();
put_marks();
putscore();
cout << "Total Score = " << total << "\n";
}
int main()
{
result student;
student.get_Rollno(101);
student.get_mark(50.25, 42.52);
student.getscore(7.0);
student.display();
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
In this program, We are passing the values by using different
methods and totaling the marks to get the result.