2015年2月15日星期日

Summary of object oriented programming concept (week #6)

Python is an object oriented language. It has class, class variable, data member, function overloading, instance variable, inheritance, instance, instantiation, method, object, operator overloading etc. Actually, what we learn in the course csc148 till now is almost all about the OOP.
Python's heart is object and OOP. In python, the basic elements are called object such as integers, strings and functions and so on. Now I want to focus on the class and inheritance. (That's because I think they are the basic two things in OOP.)
Firstly, classes define what is the common thing that the objects inside it has. We often find a general name for the class and classes correspond to variable types.
- class


 
Secondly, we subclass(extends) a superclass(base class) by *


1. declaring that we're extending it... *
class NewClass(OldClass):*
...
2. add methods and attributes to specialize*
3. other methods and attributes are searched for in superclass*
 (* are from Prof Heap's vanilla PPT)




没有评论:

发表评论