CBSE eBooks CBSE Guess > eBooks > Class XII > Computer Science By . Mr. MRK
Chapter – 5. CONSTRUCTORS & DESTRUCTORS DELHI 2008 2.b. Answer the questions (i) and (ii) after going through the following program: 2 #include <iostream.h> (i) Will statement 1 initialize all the data members for object B with the values given in the function 1 ? (YES OR NO). Justify your answer suggesting the correction(s) to be made in the above code. Ans: No. The reason is the constructor should be defined under the public visibility label. (ii) What shall be the possible output when the program gets executed ? (Assuming, if required _ the suggested correction(s) are made in the program). Ans: Possible Output: 2.c. Define a class Garments in c++ with following descriptions 4 private members:
|