An object is an instance and has:
Objects
Data abstraction captures
- interface for interacting with objects through methods (procedures)
Creating a class
- defining the class attributes
Using the class
- doing operations on the instance
Advantage of OOP
Divide-and-conquer development
Method is
A function that works only with THIS class
More about methods
Python always passes the actual object as the first argument to use as ‘self’
The “.” operator is used to:
Access any attribute:
Class is
A blueprint created by a programmer for an object
Object is
An instance of a class
Power of OOP
Implementing class vs using class
write code from two different perspectives
Implementing an object
Using an object
- do operations
Class def. of an object
Instance of a class
Why use OOP and classes of objects?
- group different objects as part of the same type
Groups of objects have attributes
- procedural attributes
Data attributes
- what it is
Procedural attributes
Behavior/operations/methods
Instance of DOT notation
Information hiding