- OOAD - Home
- OOAD - Object Oriented Paradigm
- OOAD - Object Oriented Model
- OOAD - Object Oriented System
- OOAD - Object Oriented Principles
- OOAD - Object Oriented Analysis
- OOAD - Dynamic Modelling
- OOAD - Functional Modelling
- OOAD - UML Analysis Model
- OOAD - UML Basic Notations
- OOAD - UML Structural Diagrams
- OOAD - UML Behavioural Diagrams
- OOAD - Object Oriented Design
- OOAD - Implementation Strategies
- OOAD - Testing & Quality Assurance
OOAD Functions Q/A #7
Question:Differentiate between constructor and destructor.
Answer:
| Sr. No. | Constructor | Destructor |
|---|---|---|
| 1 | A constructor is used to initialize the object. | A destructor is used to destroy the objects. |
| 2 | A constructor can take arguments. | Destructor carries no arguments. |
| 3 | Constructors are called automatically when the objects are created. | Destructors are called automatically when the objects are destroyed. |
| 4 | A constructor name should be the same as the class name. | A destructor name must also be the same as the class name but proceeded by '>' sign. |
| 5 | A constructor can not be declared as virtual. | Destructor can be virtual. |
| 6 | A constructor being member functions can be overloaded. | Destructor cannot be overloaded. |
Advertisements