Basic concepts in Oops - 2
Hi everyone, this is the continuation of the previous post. Here i am discussing some more important concepts in oops. 6) Destructor Destructors are invoked automatically when an object goes out of scope or when delete operation is used to destroy a dynamically created object. The method "destructor" is used in C++ to clean up an object's state. Garbage collector does the job of destroying unused objects in Java. 7) Inheritance Inheritance is the property by which objects of one class can access the properties of other class. There are two types of inheritance - single inheritance and multiple inheritance. In single inheritance one or more class inherit from a single base class. In multiple inheritance one or more class inherits from more than one base class. Following shows an example of inheritance. class Vehicle { int vehicleId; int milage; Vehicle(int a, int b) { vehicleId=a; milage=b; } } class Car extends Vehicle { int yearOfManufacture; Car(int a, int...