Python class and objects.
Class:
Class is nothing but an collection of objects and method.
Member variables hold (current) state. Classes enable us to implement new data types in Python.
The 'class:' statement is used to define class.
Example:
In above example 'a' is an object of class 'A'.
Methods in class:
A Method is a function define in a class which consist first parameter as 'self'.
Example of defining method:
0 Comments