Page 364 - C++
P. 364

CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
                                       (2018-2019 Sub Code: 083       Paper Code: 91)

                          NOTE:
                              ●  Deduct ½ Mark if CalVolume() is not invoked properly inside NewBox()
                                 function
                              ●  Marks not to be deducted for replacing the Formulae for calculating
                                 the Volumes with correct Formulae

                     (d)  Answer the questions (i) to (iv) based on the following:                             4
                          Class Top1(object):
                             def __init__(self,tx):         #Line 1
                                 self.X=tx                  #Line 2
                             def ChangeX(self,tx):
                                 self.X=self.X+tx

                             def ShowX(self):
                                 print self.X

                          Class Top2(object):
                             def __init__(self,ty):         #Line 3
                                 self.Y=ty                  #Line 4

                             def ChangeY(self,ty):
                                 self.Y=self.Y+ty
                             def ShowY(self):
                                 print self.Y,

                          class Bottom(Top1,Top2):
                             def __init__(self,tz):         #Line 5
                                 self.Z = tz                #Line 6
                                 Top2.__init__(self,2*tz)   #Line 7
                                 Top1.__init__(self,3*tz)   #Line 8

                             def ChangeZ(self,tz):
                                 self.Z=self.Z+tz
                                 self.ChangeY(2*tz)
                                 self.ChangeX(3*tz)
                             def ShowZ(self):
                                 print self.Z,
                                 self.ShowY()

                                 self.ShowX()
                              B=Bottom(1)
                              B.ChangeZ(2)
                              B.ShowZ()

                   (i)     Write the type of the inheritance illustrated in the above.

                   Ans    Multiple Inheritance




                                                        Page #22/35
   359   360   361   362   363   364   365   366   367   368   369