Question: What is output? #include using namespace std; class People { public: virtual void PrintInfo ( ) = 0 ; void PrintInformation ( ) { cout

What is output?
#include
using namespace std;
class People {
public:
virtual void PrintInfo()=0;
void PrintInformation(){
cout <<"In Base Class People" << endl;
}
protected:
string name;
int age;
};
class Teacher : public People {
public:
void PrintInfo(){
cout <<"In Child Class Teacher" << endl;
}
private:
int experience;
};
class Principal : public Teacher {
public:
void PrintInformation(){
cout <<"In Child Class Principal" << endl;
}
};
int main(){
Principal Tim;
Tim.PrintInfo();
return 0;
}
What is output?
#include
using namespace std;
class People {
public:
virtual void PrintInfo()=0;
void PrintInformation(){
cout <<"In Base Class People" << endl;
}
protected:
string name;
int age;
};
class Teacher : public People {
public:
void PrintInfo(){
cout <<"In Child Class Teacher" << endl;
}
private:
int experience;
};
class Principal : public Teacher {
public:
void PrintInformation(){
cout <<"In Child Class Principal" << endl;
}
};
int main(){
Principal Tim;
Tim.PrintInfo();
return 0;
}
In Base Class People
In Child Class Principal
Error: Compiler error
In Child Class Teacher

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!