SlideShare a Scribd company logo
1 of 7
CONSTUCTOR & DESTRUCTORSCONSTUCTOR & DESTRUCTORS
OBJECT ORIENTED PROGRAMMINGOBJECT ORIENTED PROGRAMMING
INDEX
Concept of constructor, types of constructorConcept of constructor, types of constructor
Overloaded constructor
Destructor
1
2
3
CONCEPT OF CONSTRUCTOR
• A constructor is a special member function
whose task is to initialize the objects of that
class.
• It is special because its name is the same as
the class name.
• Constructor is invoked whenever an object of
the associated class is created.
• It is called constructor because it constructs
the values of data members of the class.
TYPES OF CONSTRUCTOR
• Default constructor:
A constructor that accepts no parameters is called
the default constructor.
• Parameterized constructor:
The constructor that can take arguments is called as
parameterized constructor.
• Copy constructor:
a constructor can accept a reference to its own class
as a parameter which is called as copy constructor.
OVERLOADED CONSTRUCTOR
• When more than one constructor function is
defined in a class, we say the constructor is
overloaded.
DESTRUCTOR
• A destructor, as the name implies is used to
destroy the objects that have been created by
a constructor.
• Like a constructor, the destructor is also a
special member function whose name is the
same as the class name but is preceded by a
tilde(~).
• Example: the destructor for class integer can
be defined as shown below
~integer() {}
DESTRUCTOR
• A destructor, as the name implies is used to
destroy the objects that have been created by
a constructor.
• Like a constructor, the destructor is also a
special member function whose name is the
same as the class name but is preceded by a
tilde(~).
• Example: the destructor for class integer can
be defined as shown below
~integer() {}

More Related Content

What's hot

Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of ConstructorsDhrumil Panchal
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in javaTech_MX
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programmingAmar Jukuntla
 
Procedural vs. object oriented programming
Procedural vs. object oriented programmingProcedural vs. object oriented programming
Procedural vs. object oriented programmingHaris Bin Zahid
 
Dynamic memory allocation in c++
Dynamic memory allocation in c++Dynamic memory allocation in c++
Dynamic memory allocation in c++Tech_MX
 
class and objects
class and objectsclass and objects
class and objectsPayel Guria
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator OverloadingNilesh Dalvi
 
Constructor ppt
Constructor pptConstructor ppt
Constructor pptVinod Kumar
 
Dynamic memory allocation in c
Dynamic memory allocation in cDynamic memory allocation in c
Dynamic memory allocation in clavanya marichamy
 
Operator overloading
Operator overloadingOperator overloading
Operator overloadingRamish Suleman
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops conceptsNilesh Dalvi
 
Break and continue
Break and continueBreak and continue
Break and continueFrijo Francis
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in JavaAbhilash Nair
 
Encapsulation C++
Encapsulation C++Encapsulation C++
Encapsulation C++Hashim Hashim
 
Inline function in C++
Inline function in C++Inline function in C++
Inline function in C++Learn By Watch
 
Data Types & Variables in JAVA
Data Types & Variables in JAVAData Types & Variables in JAVA
Data Types & Variables in JAVAAnkita Totala
 

What's hot (20)

Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of Constructors
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programming
 
Chapter2 Encapsulation (Java)
Chapter2 Encapsulation (Java)Chapter2 Encapsulation (Java)
Chapter2 Encapsulation (Java)
 
Procedural vs. object oriented programming
Procedural vs. object oriented programmingProcedural vs. object oriented programming
Procedural vs. object oriented programming
 
Dynamic memory allocation in c++
Dynamic memory allocation in c++Dynamic memory allocation in c++
Dynamic memory allocation in c++
 
class and objects
class and objectsclass and objects
class and objects
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
 
Constructor ppt
Constructor pptConstructor ppt
Constructor ppt
 
Dynamic memory allocation in c
Dynamic memory allocation in cDynamic memory allocation in c
Dynamic memory allocation in c
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
Interface
InterfaceInterface
Interface
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
 
Inheritance C#
Inheritance C#Inheritance C#
Inheritance C#
 
Break and continue
Break and continueBreak and continue
Break and continue
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
 
Alter table command
Alter table commandAlter table command
Alter table command
 
Encapsulation C++
Encapsulation C++Encapsulation C++
Encapsulation C++
 
Inline function in C++
Inline function in C++Inline function in C++
Inline function in C++
 
Data Types & Variables in JAVA
Data Types & Variables in JAVAData Types & Variables in JAVA
Data Types & Variables in JAVA
 

Similar to constructor and destructor-object oriented programming

Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and DestructorsmurugeswariSenthilku
 
C++ Constructor and Destructors.pptx
C++ Constructor and Destructors.pptxC++ Constructor and Destructors.pptx
C++ Constructor and Destructors.pptxsasukeman
 
Constructor and destructor in oop
Constructor and destructor in oop Constructor and destructor in oop
Constructor and destructor in oop Samad Qazi
 
Constructor and Destructor
Constructor and DestructorConstructor and Destructor
Constructor and DestructorSunipa Bera
 
Constructor and Destructor in c++
Constructor  and Destructor in c++Constructor  and Destructor in c++
Constructor and Destructor in c++aleenaguen
 
Constructors in java
Constructors in javaConstructors in java
Constructors in javasunilchute1
 
Constructor and destructor
Constructor and destructorConstructor and destructor
Constructor and destructorrajshreemuthiah
 
Constructors & Destructors
Constructors  & DestructorsConstructors  & Destructors
Constructors & DestructorsRokonuzzaman Rony
 
Constructor and desturctor
Constructor and desturctorConstructor and desturctor
Constructor and desturctorSomnath Kulkarni
 
DHARANI.pptx
DHARANI.pptxDHARANI.pptx
DHARANI.pptxDharaniG29
 
Constructor & destructor
Constructor & destructorConstructor & destructor
Constructor & destructorSaharsh Anand
 
C++ Constructor destructor
C++ Constructor destructorC++ Constructor destructor
C++ Constructor destructorDa Mystic Sadi
 
What is Constructors and Destructors in C++ (Explained with Example along wi...
What is Constructors and Destructors in  C++ (Explained with Example along wi...What is Constructors and Destructors in  C++ (Explained with Example along wi...
What is Constructors and Destructors in C++ (Explained with Example along wi...Pallavi Seth
 
Java ConstructorsPPT.pptx
Java ConstructorsPPT.pptxJava ConstructorsPPT.pptx
Java ConstructorsPPT.pptxXanGwaps
 
Constructor
ConstructorConstructor
ConstructorJadavsejal
 

Similar to constructor and destructor-object oriented programming (20)

Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and Destructors
 
C++ Constructor and Destructors.pptx
C++ Constructor and Destructors.pptxC++ Constructor and Destructors.pptx
C++ Constructor and Destructors.pptx
 
Constructor and destructor in oop
Constructor and destructor in oop Constructor and destructor in oop
Constructor and destructor in oop
 
Constructor and Destructor
Constructor and DestructorConstructor and Destructor
Constructor and Destructor
 
Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructors
 
Constructor and Destructor in c++
Constructor  and Destructor in c++Constructor  and Destructor in c++
Constructor and Destructor in c++
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
 
Constructors in java
Constructors in javaConstructors in java
Constructors in java
 
Constructor and destructor
Constructor and destructorConstructor and destructor
Constructor and destructor
 
Constructors & Destructors
Constructors  & DestructorsConstructors  & Destructors
Constructors & Destructors
 
Constructor and desturctor
Constructor and desturctorConstructor and desturctor
Constructor and desturctor
 
DHARANI.pptx
DHARANI.pptxDHARANI.pptx
DHARANI.pptx
 
Constructor & destructor
Constructor & destructorConstructor & destructor
Constructor & destructor
 
C++ Constructor destructor
C++ Constructor destructorC++ Constructor destructor
C++ Constructor destructor
 
What is Constructors and Destructors in C++ (Explained with Example along wi...
What is Constructors and Destructors in  C++ (Explained with Example along wi...What is Constructors and Destructors in  C++ (Explained with Example along wi...
What is Constructors and Destructors in C++ (Explained with Example along wi...
 
Java ConstructorsPPT.pptx
Java ConstructorsPPT.pptxJava ConstructorsPPT.pptx
Java ConstructorsPPT.pptx
 
Constructor
ConstructorConstructor
Constructor
 
C++
C++C++
C++
 
C++
C++C++
C++
 
constructor.ppt
constructor.pptconstructor.ppt
constructor.ppt
 

More from Ashita Agrawal

Linux operating system - Overview
Linux operating system - OverviewLinux operating system - Overview
Linux operating system - OverviewAshita Agrawal
 
Introductio to Abstract Window Toolkit (AWT)
Introductio to Abstract Window Toolkit (AWT)Introductio to Abstract Window Toolkit (AWT)
Introductio to Abstract Window Toolkit (AWT)Ashita Agrawal
 
Inheritance in Object Oriented Programming
Inheritance in Object Oriented ProgrammingInheritance in Object Oriented Programming
Inheritance in Object Oriented ProgrammingAshita Agrawal
 
INTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMSINTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMSAshita Agrawal
 
Introduction to Sets
Introduction to SetsIntroduction to Sets
Introduction to SetsAshita Agrawal
 
Business Overview
Business OverviewBusiness Overview
Business OverviewAshita Agrawal
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to JavaAshita Agrawal
 
Biography of Mahatma Gandhi : 1869-1948
Biography of Mahatma Gandhi : 1869-1948Biography of Mahatma Gandhi : 1869-1948
Biography of Mahatma Gandhi : 1869-1948Ashita Agrawal
 
Cloud computing - new class of network based computing
Cloud computing - new class of network based computingCloud computing - new class of network based computing
Cloud computing - new class of network based computingAshita Agrawal
 
Introduction to computer network
Introduction to computer networkIntroduction to computer network
Introduction to computer networkAshita Agrawal
 
Instruction Set of 8086 Microprocessor
Instruction Set of 8086 MicroprocessorInstruction Set of 8086 Microprocessor
Instruction Set of 8086 MicroprocessorAshita Agrawal
 
Testing Machine- universal tester
Testing Machine- universal testerTesting Machine- universal tester
Testing Machine- universal testerAshita Agrawal
 
Adolf Hitler - German politician(world war I)
Adolf Hitler - German politician(world war I)Adolf Hitler - German politician(world war I)
Adolf Hitler - German politician(world war I)Ashita Agrawal
 
Charles babbage - Father of Computing.
Charles babbage - Father of Computing. Charles babbage - Father of Computing.
Charles babbage - Father of Computing. Ashita Agrawal
 
Ada Lovelace-The First Programmer
Ada Lovelace-The First ProgrammerAda Lovelace-The First Programmer
Ada Lovelace-The First ProgrammerAshita Agrawal
 
Augmented Reality
Augmented RealityAugmented Reality
Augmented RealityAshita Agrawal
 

More from Ashita Agrawal (17)

Linux operating system - Overview
Linux operating system - OverviewLinux operating system - Overview
Linux operating system - Overview
 
Introductio to Abstract Window Toolkit (AWT)
Introductio to Abstract Window Toolkit (AWT)Introductio to Abstract Window Toolkit (AWT)
Introductio to Abstract Window Toolkit (AWT)
 
Inheritance in Object Oriented Programming
Inheritance in Object Oriented ProgrammingInheritance in Object Oriented Programming
Inheritance in Object Oriented Programming
 
INTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMSINTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMS
 
Introduction to Sets
Introduction to SetsIntroduction to Sets
Introduction to Sets
 
Business Overview
Business OverviewBusiness Overview
Business Overview
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
 
Biography of Mahatma Gandhi : 1869-1948
Biography of Mahatma Gandhi : 1869-1948Biography of Mahatma Gandhi : 1869-1948
Biography of Mahatma Gandhi : 1869-1948
 
Cloud computing - new class of network based computing
Cloud computing - new class of network based computingCloud computing - new class of network based computing
Cloud computing - new class of network based computing
 
Introduction to computer network
Introduction to computer networkIntroduction to computer network
Introduction to computer network
 
Instruction Set of 8086 Microprocessor
Instruction Set of 8086 MicroprocessorInstruction Set of 8086 Microprocessor
Instruction Set of 8086 Microprocessor
 
Testing Machine- universal tester
Testing Machine- universal testerTesting Machine- universal tester
Testing Machine- universal tester
 
Adolf Hitler - German politician(world war I)
Adolf Hitler - German politician(world war I)Adolf Hitler - German politician(world war I)
Adolf Hitler - German politician(world war I)
 
Charles babbage - Father of Computing.
Charles babbage - Father of Computing. Charles babbage - Father of Computing.
Charles babbage - Father of Computing.
 
Ada Lovelace-The First Programmer
Ada Lovelace-The First ProgrammerAda Lovelace-The First Programmer
Ada Lovelace-The First Programmer
 
Slums In India
Slums In IndiaSlums In India
Slums In India
 
Augmented Reality
Augmented RealityAugmented Reality
Augmented Reality
 

Recently uploaded

An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgsaravananr517913
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction managementMariconPadriquez1
 
Piping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringPiping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringJuanCarlosMorales19600
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxsomshekarkn64
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptMadan Karki
 

Recently uploaded (20)

An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction management
 
Piping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringPiping Basic stress analysis by engineering
Piping Basic stress analysis by engineering
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptx
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.ppt
 

constructor and destructor-object oriented programming

  • 1. CONSTUCTOR & DESTRUCTORSCONSTUCTOR & DESTRUCTORS OBJECT ORIENTED PROGRAMMINGOBJECT ORIENTED PROGRAMMING
  • 2. INDEX Concept of constructor, types of constructorConcept of constructor, types of constructor Overloaded constructor Destructor 1 2 3
  • 3. CONCEPT OF CONSTRUCTOR • A constructor is a special member function whose task is to initialize the objects of that class. • It is special because its name is the same as the class name. • Constructor is invoked whenever an object of the associated class is created. • It is called constructor because it constructs the values of data members of the class.
  • 4. TYPES OF CONSTRUCTOR • Default constructor: A constructor that accepts no parameters is called the default constructor. • Parameterized constructor: The constructor that can take arguments is called as parameterized constructor. • Copy constructor: a constructor can accept a reference to its own class as a parameter which is called as copy constructor.
  • 5. OVERLOADED CONSTRUCTOR • When more than one constructor function is defined in a class, we say the constructor is overloaded.
  • 6. DESTRUCTOR • A destructor, as the name implies is used to destroy the objects that have been created by a constructor. • Like a constructor, the destructor is also a special member function whose name is the same as the class name but is preceded by a tilde(~). • Example: the destructor for class integer can be defined as shown below ~integer() {}
  • 7. DESTRUCTOR • A destructor, as the name implies is used to destroy the objects that have been created by a constructor. • Like a constructor, the destructor is also a special member function whose name is the same as the class name but is preceded by a tilde(~). • Example: the destructor for class integer can be defined as shown below ~integer() {}