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

Answer the following questions (i) to (ii) after going through the following program.
Note Assume all necessary header files are already being included in the program.

class Market
{
char Name[20];
char Address[20];
int noofshops;
float Price;

Market() //Function1
{
strcpy(Name,"CWK";
strcpy(Address,"Delhi");
noodshops=20;
Price=50000;
}
public:
void Show() //Function2
{
cout<<"-"<<Address<<":"<<noofshops<<"@"<<Price;
}
};
void main()
{
Market M; //Statement1
M.Show(); //Statement2
}

(i) Will Statement1 initialize all the data members for object M with the values given in the Funciton1? (Yes or No). Justify your answer suggesting the correction(s) to be made in the above code.
(ii) In Object Oriented Programming, what is Funciton1 referred as and when does it get invoked/called?




No comments

Post your comments

Powered by Blogger.