trilok sharma
Compare Accessibility of Python and Java • Java is a static and strong type definition language. Java has strict definition of accessibility type with keywords. • While Python is a dynamic and weak type definition language. Python acquiesces all the accessibility types are pu...
See more
Polymorphism • Polymorphism is an important definition in OOP. Absolutely, we can realize polymorphism in Python just like in JAVA. I call it “traditional polymorphism” • In the next slide, there is an example of polymorphism in Python. • But in Python,
Encapsulation – Accessibility (1) • In Python, there is no keywords like ‘public’, ‘protected’ and ‘private’ to define the accessibility. In other words, In Python, it acquiesce that all attributes are public.
An Example of Multiple Inheritance C multiple-inherit A and B, but since A is in the left of B, so C inherit A and invoke A.A() according to the left-to-right sequence. To implement C.B(), class A does not have B() method, so C inherit B for the second priority. So C.B() actually...
See more
Form and Object for Class • Class includes two members: form and object. • The example in the following can reflect what is the difference between object and form for class.
Class Definition and Object Instantiation • Class definition syntax: class subclass[(superclass)]: [attributes and methods] • Object instantiation syntax: object = class() • Attributes and methods invoke: object.attribute object.method()
Advantages of Python • Simple • Easy to study • Free and open source • High-level programming language • Portability • Expansibility • Embedability • Large and comprehensive standard libraries • Canonical code
To add a new element to a list we use which command ?