전체 글
-
-
-
[OOP] The Four Core Principles of OOP🐍 파이썬/파이썬 기본 문법 2022. 7. 28. 12:10
•Abstraction •Define a concept, unrelated to a concrete instance. •Encapsulation •Hide implementation details (Fields cannot be overridden!). •Inheritance •Extend classes to reuse code (inherit behavior), is-arelationships. •Polymorphism •Replacing functionality in specializations. Dynamic selection of methods.
-
[inheritance] 상속 with 예제🐍 파이썬/파이썬 기본 문법 2022. 7. 28. 12:08
In OOP languages, classes can extend existing classes to inherit their behavior. At the same time, they can changeand extendthe behavior. *reminder : A class is an abstraction and represents a consistent combination of state(instance variables or “fields”) and operations to alter this state (“methods”). Lets start with the class represents "Animal" which has age and food state, and next_day, fee..
-
-
-
[class] python-specific special method🐍 파이썬/파이썬 기본 문법 2022. 7. 27. 11:44
By Default, Printing An Object Is Not Helpful. Redefine __str__ method to Improve Output. Goal of havung __str__ is to create human-readable representation of an object. Why doesn’t it work in collections? Collections use __repr__ to print the contained objects ! Goal of __repr__is to create unambiguous representation of an object. By Default, Different Objects Are Not Equal Redefine __eq__ to A..