Page 69 - C++
P. 69

}
                                    void main ( )
                                    {
                                           int X=7, Y=4, Z=3;
                                           char C='#' ;
                                           My_fun (C,Y) ;
                                           My_fun (X,Z) ;
                             }

                                                                OR

                             Write any four differences between Constructor and Destructor function
                             with respect to object oriented programming

                      Ans.  ####
                             71421
                             Polymorphism
                             OR
                             Function Overloading

                                                                OR
                                         Constructor                          Destructor
                              Name of the constructor function is  Name of the destructor function is
                              same as that of class               same as that of class preceded by
                                                                  ~
                              Constructor functions are called    Destructor functions are called
                              automatically at the time of        automatically when the scope of
                              creation of the object              the object gets over
                              Constructor can be overloaded       Destructor ca not be overloaded
                              Constructor is used to initialize the  Destructor is used to de- initialize
                              data members of the class           the data members of the class


                             (½ Mark for writing each correct line of output)
                             (1 Mark for writing the feature name correctly)

                                                                OR

                             (½ Mark for writing  each correct difference)

                      (c)    Define a class Ele_Bill in C++ with the following descriptions:               (4)
                             Private members:
                                      Cname                    of type character array
                                      Pnumber                        of type long
                                      No_of_units               of type integer
                                       Amount                      of type float.
                                       Calc_Amount( )           This member function should calculate the
                                              amount asNo_of_units*Cost .



                                                              5
   64   65   66   67   68   69   70   71   72   73   74