The focus of the last two weeks of CSC148 was that Python is an
object-oriented programming language. The basic building block of a
Python-based software is objects. The way we can define an object is using
class. A class is a blueprint for an object that consists of attributes and
methods. Attributes characterizes the object of the class, and the methods
describe the behavior of the class. The most interesting characteristic of
class is “inheritance”. The subclass can inherit, override, or extend any
attributes or methods of the superclass. Also, a subclass can inherit from
multiple superclasses. This is advantageous in that it avoids repetition of duplicate
codes and that the relationships between different classes are visible. At
first, it was difficult to understand this topic but using the analogy to
biology helped me clarify the ideas. Inherited methods or attributes are like the
characteristics that I received from my parents, overridden methods are the
common but different characteristics, and extended methods are the unique
characteristics that I own independently.
No comments:
Post a Comment