Biology, asked by monicaanand799, 1 year ago

Create a base class fruit with name ,taste and size as its attributes. Create a method called eat() which describes the name of the fruit and its taste.

Answers

Answered by Anonymous
1

in python:

class fruit:

def__init__(self,taste,size,name):

self.taste=taste

self.name=name

self.size=size

def eat(self):

print(name,taste)

class apple(fruit):

def__init__(self,taste,size,name):

super().__init__(taste,size,name)

def eat(self):

print(name,taste):

class orange(apple):

def__init__(self,taste,size,name):

super().__init__(taste,size,name)

def eat(self):

print(name,taste):

Similar questions