Post by account_disabled on Dec 16, 2023 23:11:16 GMT -5
We made a dog class which is extending the animals class which we created before. We are also using the parameters from the Animals using the Animals.__init__(arguments) which has name and legs which will be inherited to the dog class.Then we are making an instance C Level Executive List attribute for the dog class which is breed.
Now let’s make an object for the dog class and access the attributes and methods of the animals class. class Animals: type=”mammals” def __init__(self,name,legs): self.name=name self.legs=legs def bark(self): if self.name==”dog”: print(“woof woof!!!”) else: print(“not a dog”) class Dog(Animals): def __init__(self,name,legs,breed): Animals.__init__(self,name,legs) self.breed=breed pug=Dog("dog",4,"pug") pug.breed pug.name pug.legs pug.bark() #Output pug dog 4 woof woof!!! As we can see from the output the parent class attributes and methods are being accessed by the child class object. In this blog, we have covered some basics of classes in Python. In the next blog post we will cover the topic of file handling.Project expectations and how to meet them › Blog › Project management › Project expectations and how to meet them Caroline Becker Jan 25 Blog, Project management project_expectations
The task of carrying out a project bears a heavy responsibility. Whether you work as a Project Manager or a freelancer, you have to meet several defined and high project expectations. On many occasions due to the lack of proper communication, those requirements get misunderstood and misinterpreted. The team loses morale as time is used to make the project less chaotic instead of moving forward. How to make a project meet all expectations? In today’s article, we would like to provide you with some guidance, which when put into practice will ensure that your project is carried out flawlessly and with ease.
Now let’s make an object for the dog class and access the attributes and methods of the animals class. class Animals: type=”mammals” def __init__(self,name,legs): self.name=name self.legs=legs def bark(self): if self.name==”dog”: print(“woof woof!!!”) else: print(“not a dog”) class Dog(Animals): def __init__(self,name,legs,breed): Animals.__init__(self,name,legs) self.breed=breed pug=Dog("dog",4,"pug") pug.breed pug.name pug.legs pug.bark() #Output pug dog 4 woof woof!!! As we can see from the output the parent class attributes and methods are being accessed by the child class object. In this blog, we have covered some basics of classes in Python. In the next blog post we will cover the topic of file handling.Project expectations and how to meet them › Blog › Project management › Project expectations and how to meet them Caroline Becker Jan 25 Blog, Project management project_expectations
The task of carrying out a project bears a heavy responsibility. Whether you work as a Project Manager or a freelancer, you have to meet several defined and high project expectations. On many occasions due to the lack of proper communication, those requirements get misunderstood and misinterpreted. The team loses morale as time is used to make the project less chaotic instead of moving forward. How to make a project meet all expectations? In today’s article, we would like to provide you with some guidance, which when put into practice will ensure that your project is carried out flawlessly and with ease.