>> class Satu:
>> def __init__(self, desc):
>> self.desc = desc
>> def setDesc(self, desc):
>> self.desc = desc
>> def.getDesc(self):
>> return self.desc
To make an inherited class, use:
>> class Dua(Satu):
>> def __init__(self, name):
>> self.name = name
>> def setName(self,name):
>> self.name = name
>> def getName(self):
>> return self.nameFor object of Dua, the desc attribute is not valid because dua has no attribute of desc. So dua cannot access getDesc() method.
No comments:
Post a Comment