May 2017
Intermediate to advanced
280 pages
6h 2m
English
Now, after understanding some basic concepts of OOPs, let's understand them with some programming.
Creating a class in Python is quite easy. Refer to the following syntax:
class <class name >(<parent class name>): <method definition-1> <method definition-n>
Let's create a class1.py program. In this program, we are creating an empty class:
class Leapx_org(): pass
We have just created a Leapx_org class. This class is empty, the class body just contains the pass statement. Basically, the class is a blueprint to create instances. Let's create the instances:
L_obj1 = Leapx_org()L_obj2 = Leapx_org() print L_obj1print L_obj2
Let's run the class1.py program:
In the preceding screenshot, you can ...
Read now
Unlock full access