Example Analysis of object-oriented Design and object-oriented programming in python
This article will explain in detail the example analysis of object-oriented design and object-oriented programming in python. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
1. Object-oriented design means that everything is an object, and each object has its own characteristics and functions.
Object-oriented programming is not necessarily required, but can also be achieved in other ways.
2. Object-oriented programming must be realized by object-oriented design.
The idea of object-oriented design integrates these features and functions together, that is, object-oriented design, object-oriented programming integrates the common properties and functions of a class of things by defining classes, and creates functions through examples.
Object-oriented programming is only one way to realize object-oriented design, and object-oriented design can also be realized in other ways.
Example
# here put the import lib def dogs (name, age, kind): def init (name, age, kind): dog = {"name": name, "age": age, "kind": kind, "intro": intro, "yell": yell} return dog def intro (dog): print ("This% s's name is% s It's% s years old. "% (dog [" kind "], dog [" name "], dog [" age "]) def yell (dog): print (" The% s is wangwangwang "% (dog [" kind "]) return init (name, age, kind) D1 = dogs (" sunny chen ", 21) "Look") print (D1 ["name"]) D1 ["intro"] (D1) on "sample Analysis of object-oriented Design and object-oriented programming in python" Hope that the above content can be helpful to you, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.