Page 40 - C++
P. 40

(i)    Explain the relationship between Line 1 , Line 2 and Line 3.
               Ans    Line 1 is a parameterized constructor of derived class RacingCar that accepts values for
                      its  instance variables  turnRadius ,speed . It accepts clr,seats,l,w  to initialize the
                      instance variables   colour with clr , seatingCapacity with seats of base class Car
                      through its constructor function/__init__()(Line 2) and invokes  constructor
                      function/__init__() of base class Vehicle to initialize its instance variables length with l
                      and width with w(Line 3).

                      (2 marks for appropriate answer justifying the passing of parameters to initialize
                      members of base class via __init__( ))


               (ii)   Predict the output that will be produced on the execution of the following statements :






               Ans





                      (½ mark for each line of output)








                                                        Page No. 23
   35   36   37   38   39   40   41   42   43   44   45