CBSE Computer Science - Revision Tour(Solved) CBSE Guess > eBooks > Class XII > CBSE Computer Science Constructors And Destructors Solved Revision Tour By Mr. Ravi Kiran COMPUTER SCIENCE CONSTRUCTORS AND DESTRUCTORS Warning: include(../../../ads_330x250_middle.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/computer_science1/constructors_destructors4.php on line 22 Warning: include(): Failed opening '../../../ads_330x250_middle.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/computer_science1/constructors_destructors4.php on line 22 OUTSIDE DELHI: 2007: 2.b) Answer the questions (i) and (ii) after going through the following class :
(i) Name the specific features of class shown by Function 1 and Function 2 in the above example. 2 Ans: Member function 1 is a (nonparameterized 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 : Private Members:
Public Members:
For each Child the above Fare will be 50% of the Fare mentioned in the above table For Example: If Distance is 750, No_of_adults =3 and No_of_Children =2 .Then TotalFare should be calculated as Num_of _Adults *300+ No_of_Children *150 i.e., 3*300+ 2 *150 =1200
4 CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( [email protected] ) |
Warning: include(../../../120_60_others.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/computer_science1/constructors_destructors4.php on line 170 Warning: include(): Failed opening '../../../120_60_others.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/computer_science1/constructors_destructors4.php on line 170 |