Page 325 - C++
P. 325

(i)     Which Object Oriented Programming feature is illustrated by
                           the definitions of classes FIRST and SECOND ?                           1


                   (ii)    Write  Statement  1  and  Statement  2  to  execute  Member
                           Function  1  and  Member  Function  2  respectively  using  the
                           object S.                                                               1






           (c)     Write  the  definition  of  a  class  CONTAINER  in  C++  with  the
                   following description :                                                         4


                   Private Members


                   - Radius, Height           // float
                   - Type                     // int (1 for Cone,2 for Cylinder)
                   - Volume                   // float

                   - CalVolume()              // Member function to calculate
                                              // volume as per the Type



                      Type      Formula to calculate Volume


                        1       3.14*Radius*Height


                        2       3.14*Radius*Height/3



                   Public Members

                   - GetValues()  // A function to allow user to enter value
                                      // of Radius, Height and Type. Also, call

                                      // function CalVolume() from it


                   - ShowAll()  // A function to display Radius, Height,
                                      // Type and Volume of Container



      91                                             6
   320   321   322   323   324   325   326   327   328   329   330