🐍 파이썬
-
-
-
[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..
-
[OOP] class 클래스 개념 및 구성요소🐍 파이썬/파이썬 기본 문법 2022. 7. 27. 11:30
What is "Object-oriented" programming? •"Object-orientation" is just one of many programming paradigms : Our world is made up of "things", so it is a good model of the world! •Practical considerations: -Facilitates testing(we can test the classes separately) -Encourages reuse(we can reuse classes defined by other people) -Users don’t need to know the inner workings of a class, they just rely on ..