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

Answer the questions (i) and (ii) after going through the following class:

class Market
{
int Mcode:
char Mname[25];
char Area[30];
public:
Market() //Function1
{
cout<<"Buy"<<endl;
Mcode = 101;
strcpy(Mname, "Brand");
strcpy(Area, "Meerut");
}
Market(int M, char N[], char A[]) //Function2
{
Mcode = M;
strcpy(Mname, "Brand");
strcpy(Area, "Meerut");
}
void Ad(int M); //Function3
{
Mcode += M;
}
void Display() //Function4
{
cout<<Mcode<<":"<<Mname<<:<<<<Area<<endl;
}
~ Market() //Function5
{
cout<<"Market Closed !!!"endl;
}
};
void main()
{
Market M1, M2(105, "Brand New", "Abulane");
for(int k=0;k<55;k++
{
M1.Ad(25);M2.Ad(30);
M1.Display();
M2.Display();
}
}

(i) Which specific concept of Object Oriented Programming out of the following is illustrated by Function1 and Function2 combined together?
(ii) How many times the message "Market Closed!!!"will be displayed after executing the above C++ code? Out of Line1 to Line10 which line is responsible to display the message "Market Closed!!!"?



No comments

Post your comments

Powered by Blogger.