Hi ! Studying late night...
03:56 am

Sponsor Area

Sponsor Area

Question is

Observe the following C++ code and answer the questions (i) and (ii). Assume all necessary files are included:

class FICTION
{
	long FCode;
	char FTitle[20];
	float FPrice;
public:
FICTION() //Member Function 1
{
	cout<<'Bought'<<endl;
	FCode=100;strcpy(FTitle,'Noname');FPrice=50;
}
FICTION(int C,char T[],float P) //Member Function 2
{
	FCode=C;
	strcpy(FTitle,T);
	FPrice=P;
}
void Increase(float P) //Member Function 3
{
	FPrice+=P;
}
void Show() //Member Function 4
{
	cout<<FCode<<':'<<FTitle<<':'<<FPrice<<endl;
}
~FICTION() //Member Function 5
{
	cout<<'Fiction removed!'<<end1;
}
};
void main()	 //Line 1
{               //Line 2
FICTION F1,F2(101,'Dare',75); 	//Line 3
for (int I=0;I<4;I++) 		//Line 4
{    //Line 5
	F1.Increase(20);F2.Increase(15); 	//Line 6
	F1.Show();F2.Show();  	//Line 7
}		//Line 8
}		//Line 9

Which specific concept of object-oriented programming out of the following is illustrated by Member Function 1 and Member Function 2 combined together?

  1. Data Encapsulation
  2. Data Hiding
  3. Polymorphism
  4. Inheritance

Mock Test Series

Sponsor Area

Sponsor Area

NCERT Book Store

NCERT Sample Papers

Entrance Exams Preparation