+2 votes
in Class 12 by kratos

Answer the question (i) to (iv) based on the following:

Class Shop (object):

Class shop_(self) :

self . no_of _employees = 0

self. no_of _brands= 0

def getSdate (self) :

self. no_of_employees=input(“Number of employees”)

self.no_of_brands=input(”Number of brands”)

def showSdate (self) :

Print self.no of employees

Print self.no of brands class Brand (object) :

def init_(self) :

self.name = ” ”

self.category=(“Mens”, “Womens”, “Kids”)

self.avgprice=0, 0

def getdate (self) :

self.name = raw_input(“Enter Brand Name”)

self.avgprice = input(”Enter Average Price”)

def showdate (self) :

Print self, name

Print self, category

Print self, avgprice

Class Mall (Brand, Shop) :

def showdate (self) :

self.no of shops = 0

def getdate (self) :

super (mall, self).getSdate ( ) # Statement

super (mall, self).getdate ( ) # Statement 2

self.no_of_shops=input (“Enter number of shops”)

def showdata(self)

print self.no_of_shops

print self.no of brands # Blank 1

  1. Which type of inheritance is demonstrated in the above code?

  2. Explain Statement 1 and 2.

  3. Name the methods that are overridden along with their class name.

  4. Fill Blank 1 with a statement to display variable category of class Brand.

1 Answer

+5 votes
by kratos
 
Best answer
  1. Multiple Inheritance

  2. Statement 1 and 2 invoke the getSdate() function of class shop and getData() function of class Brand respectively.

  3. getdata() method of class Brand is overridden. When object of class Mall is created.

M=Mall ( )

k.getdata ( )

getdate( ) methodof class Mall is invoked and not of class Brand is called.

  1. print Brand ( ). category
...