July 2018
Intermediate to advanced
462 pages
12h 2m
English
To use the variables and methods of any class, we need to create its objects or instances. An instance of a class gets its own copy of variables and methods. This means the variable of one instance will not interfere with the variable of another instance. We can create as many instances of a class as desired. To create an instance of a class, you need to write the class name followed by arguments (if any). For example, the following statement creates an instance of the Student class with the name studentObj:
studentObj=Student()
You can create any number of instances of the Student class. For example, the following line creates another instance of the Student class:
courseStudent=Student()
Now, the instance can access the class ...
Read now
Unlock full access