CBSE eBooks CBSE Guess > eBooks > Class XII > Computer Science By . Mr. MRK
Chapter – 5. CONSTRUCTORS & DESTRUCTORS OUTSIDE DELHI: 2007 2.b. Answer the questions (i) and (ii) after going through the following class : 2 class Science (i) Name the specific features of class shown by Function 1 and Function 2 in the above example. Ans: Member function 1 is a (non-parameterized or default) constructor (, which will be executed automatically at the time of creation of an object of class Science). Member function 2 is a destructor (,which will be executed automatically at the time of destruction of an object of class Science). (ii) How would Function 1 and Function 2 get executed ? Ans: They will be executed automatically. Member function 1 will be executed at the time of creation of an object of class Science. Member function 2 will be executed at the time of destruction of an object of class Science. 2.c. Define a class Travel in C++ with the description given below : 4 Private Members: |