Page 276 - C++
P. 276

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


                   Private Members

                   - BoxNumber  // data member of integer type

                   - Side            // data member of float type

                   - Area            // data member of float type

                   - ExecArea() // Member function to calculate and assign

                                     // Area as Side * Side


                   Public Members

                   - GetBox()  // A function to allow user to enter values of

                                    // BoxNumber and Side. Also, this
                                    // function should call ExecArea() to calculate

                                    // Area


                   - ShowBox() // A function to display BoxNumber, Side
                                    // and Area



           (d)     Answer the questions (i) to (iv) based on the following :                       4

                   class First

                   {

                       int X1;

                   protected:

                       float X2;


                   public:

                       First();

                       void Enter1(); void Display1();
                   };
      91                                             6
   271   272   273   274   275   276   277   278   279   280   281