Page 230 - C++
P. 230

(c)   Write the definition of a class RING in C++ with following description :         4
                         Private Members
                         - RingNumber  // data member of integer type
                         - Radius           // data member of float type
                         - Area             // data member of float type
                         - CalcArea()  // Member function to calculate and assign
                                            // Area as 3.14 ∗ ∗∗ ∗ Radius∗ ∗∗ ∗Radius
                         Public Members
                         - GetArea()        // A function to allow user to enter values of
                                            // RingNumber and Radius. Also, this
                                            // function should call CalcArea() to calculate
                                            // Area

                         - ShowArea()  // A function to display RingNumber, Radius
                                            // and Area
                   (d)  Answer the questions (i) to (iv) based on the following :                         4
                         class One
                         {
                              int A1;
                         protected:
                              float A2;
                         public:
                              One();
                              void Get1(); void Show1();
                         };
                         class Two : private One
                         {
                              int B1;
                         protected:
                              float B2;
                         public:
                              Two();
                              void Get2();
                              void Show();
                         };
                         Class Three : public Two
                         {
                              int C1;
                         public:
                              Three();
                              void Get3();
                              void Show();
                         };
                         void main()
                         {
                              Three T;            //Statement 1
                              __________;         //Statement 2
                         }
             91/1                                          5                                        [P.T.O.
   225   226   227   228   229   230   231   232   233   234   235