What is the output of following program?


			  		

Loading

Practice OOPS Concepts –

What is the output of following program?

#include <iostream>
using namespace std;

class Player
{
private:
int id;
static int next_id;
public:
int getID() { return id; }
Player() { id = next_id++; }
};
int Player::next_id = 1;

int main()
{
Player p1;
Player p2;
Player p3;
cout << p1.getID() << " ";
cout << p2.getID() << " ";
cout << p3.getID();
return 0;
}

What is the error in the following code?


			  		

Loading

Practice Function Overloading –

What is the error in the following code?

class t
{
virtual void print();
}

 

A pure virtual function is a virtual function that

Loading

Practice Function Overloading –

A pure virtual function is a virtual function that

RunTime Polymorphism is achieved by ___________. 

 

Loading

Practice OOPS Concepts –

RunTime Polymorphism is achieved by ___________. 

 

Consider the following class definitions:


			  		

Loading

Practice Objects and Classes –

Consider the following class definitions:

class a
{
};
class b: protected a
{
};

What happens when we try to compile this class?

To convert from a user defined class to a basic type, you would mos

Loading

Practice Objects and Classes –

To convert from a user defined class to a basic type, you would most likely use.

A template class

Loading

Practice Objects and Classes –

A template class

The keyword friend does not appear in

Loading

Practice Friend Functions –

The keyword friend does not appear in