FUNCTIONS, CONSTRUCTOR, DESTRUCTOR & OVERLOADING QUESTIONS IN C++. (10)

Observe the following C++ code and answer the questions (i) and (ii).
Note Assume all required header files are already being included in the program:

class Test
{
int Rno, marks;
char subj[10];
public:
Test() //Funciton1
{
Rno=25;
marks=95;
strcpy(subj,"Math");
}
Test(int Srno, int Smarks) //Funciton2
{
Rno=Srno;marks=Smarks;
}
~ Test() //Function3
{
cout<<"Test over"<<endl;
}
void show() //Funciton4
{
cout<<Rno<<":"<<marks<<":"<<subj<<endl;
}
};
void main()
{
clrscr();
Test T1,T2(12,96);
for(int i=0;i<4;i++)
{
T1.show();
T2.show();
}
getch();
}

(i) As per Object Oriented Programming which concept is illustrated by Function1 adn Funciton2 together?
(ii) How many times the message "Test over" will be displayed after executing the above C++ code?


No comments

Post your comments

Powered by Blogger.