SlideShare a Scribd company logo
1 of 6
Constructor
Overloading
Yogendra Pal
At the end of this tutorial you will be able to
• Overload a constructor.
• Differentiate between initialized and uninitialized object.
• Identify overloaded functions from a given c++ program.
• Identify which function will execute on a call to overloaded function.
• Call a constructor explicitly and implicitly.
www.learnbywatch.com | yogendra@learnbywatch.com
Constructor Overloading
• Creating more than one constructors for a c++ class.
• Signature of each constructor should be different.
• Allow to create both initialized and uninitialized objects.
www.learnbywatch.com | yogendra@learnbywatch.com
Create an initialized object
Uninitialized Object
• Time t;
• Time t = Time();
• Member variables are not
initialized.
Initialized Object
• Time t(04,02,1985);
• Time t = Time(04, 02, 1985);
• Member variables are
initialized.
www.learnbywatch.com | yogendra@learnbywatch.com
How to use Constructors?
• Two ways to initialize an object by using a constructor:
• An Explicit call to constructor: Time t1 = Time(12, 24, 10);
• An Implicit call to constructor: Time t1(12, 24, 10);
• Constructor is called whenever you create an object of a class.
• The constructor creates object.
• There is no object until the constructor finishes it’s work.
• You can’t call a constructor with an object.
www.learnbywatch.com | yogendra@learnbywatch.com
Ask Questions
to learn better
Yogendra Pal
www.learnbywatch.com | yogendra@learnbywatch.com

More Related Content

What's hot

Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructorsNilesh Dalvi
 
Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template LibraryGauravPatil318
 
Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programmingSachin Sharma
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator OverloadingNilesh Dalvi
 
Inline function in C++
Inline function in C++Inline function in C++
Inline function in C++Jenish Patel
 
06. operator overloading
06. operator overloading06. operator overloading
06. operator overloadingHaresh Jaiswal
 
List Data Structure
List Data StructureList Data Structure
List Data StructureZidny Nafan
 
Inline Functions and Default arguments
Inline Functions and Default argumentsInline Functions and Default arguments
Inline Functions and Default argumentsNikhil Pandit
 
Structure of C++ - R.D.Sivakumar
Structure of C++ - R.D.SivakumarStructure of C++ - R.D.Sivakumar
Structure of C++ - R.D.SivakumarSivakumar R D .
 
Operator overloading in C++
Operator  overloading in C++Operator  overloading in C++
Operator overloading in C++BalajiGovindan5
 
L21 io streams
L21 io streamsL21 io streams
L21 io streamsteach4uin
 
Hash table in java
Hash table in javaHash table in java
Hash table in javasiriindian
 
Standard template library
Standard template libraryStandard template library
Standard template libraryJancypriya M
 
Standard template library
Standard template libraryStandard template library
Standard template librarySukriti Singh
 

What's hot (20)

Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructors
 
Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template Library
 
Java Arrays
Java ArraysJava Arrays
Java Arrays
 
Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programming
 
Array in c++
Array in c++Array in c++
Array in c++
 
2D Array
2D Array2D Array
2D Array
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
 
Inline function in C++
Inline function in C++Inline function in C++
Inline function in C++
 
06. operator overloading
06. operator overloading06. operator overloading
06. operator overloading
 
List Data Structure
List Data StructureList Data Structure
List Data Structure
 
Inline Functions and Default arguments
Inline Functions and Default argumentsInline Functions and Default arguments
Inline Functions and Default arguments
 
Structure of C++ - R.D.Sivakumar
Structure of C++ - R.D.SivakumarStructure of C++ - R.D.Sivakumar
Structure of C++ - R.D.Sivakumar
 
Wrapper class
Wrapper classWrapper class
Wrapper class
 
Operator overloading in C++
Operator  overloading in C++Operator  overloading in C++
Operator overloading in C++
 
java token
java tokenjava token
java token
 
L21 io streams
L21 io streamsL21 io streams
L21 io streams
 
Constructor
ConstructorConstructor
Constructor
 
Hash table in java
Hash table in javaHash table in java
Hash table in java
 
Standard template library
Standard template libraryStandard template library
Standard template library
 
Standard template library
Standard template libraryStandard template library
Standard template library
 

Viewers also liked

Constructor and destructor in c++
Constructor and destructor in c++Constructor and destructor in c++
Constructor and destructor in c++Learn By Watch
 
Oop Constructor Destructors Constructor Overloading lecture 2
Oop Constructor  Destructors Constructor Overloading lecture 2Oop Constructor  Destructors Constructor Overloading lecture 2
Oop Constructor Destructors Constructor Overloading lecture 2Abbas Ajmal
 
Constructor & destructor
Constructor & destructorConstructor & destructor
Constructor & destructorSaharsh Anand
 
Friend function & friend class
Friend function & friend classFriend function & friend class
Friend function & friend classAbhishek Wadhwa
 
friend function(c++)
friend function(c++)friend function(c++)
friend function(c++)Ritika Sharma
 
C++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorC++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorJussi Pohjolainen
 
Constructor and Destructor
Constructor and DestructorConstructor and Destructor
Constructor and DestructorKamal Acharya
 
Overloading in java
Overloading in javaOverloading in java
Overloading in java774474
 
constructor and destructor-object oriented programming
constructor and destructor-object oriented programmingconstructor and destructor-object oriented programming
constructor and destructor-object oriented programmingAshita Agrawal
 
Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)Ritika Sharma
 
Friends function and_classes
Friends function and_classesFriends function and_classes
Friends function and_classesasadsardar
 
Bca 2nd sem u-2 classes & objects
Bca 2nd sem u-2 classes & objectsBca 2nd sem u-2 classes & objects
Bca 2nd sem u-2 classes & objectsRai University
 

Viewers also liked (18)

Constructor ppt
Constructor pptConstructor ppt
Constructor ppt
 
Constructor and destructor in c++
Constructor and destructor in c++Constructor and destructor in c++
Constructor and destructor in c++
 
Closer look at classes
Closer look at classesCloser look at classes
Closer look at classes
 
Constructor Overloading in java
Constructor Overloading in javaConstructor Overloading in java
Constructor Overloading in java
 
Oop Constructor Destructors Constructor Overloading lecture 2
Oop Constructor  Destructors Constructor Overloading lecture 2Oop Constructor  Destructors Constructor Overloading lecture 2
Oop Constructor Destructors Constructor Overloading lecture 2
 
Constructor & destructor
Constructor & destructorConstructor & destructor
Constructor & destructor
 
Friend function & friend class
Friend function & friend classFriend function & friend class
Friend function & friend class
 
friend function(c++)
friend function(c++)friend function(c++)
friend function(c++)
 
Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and Destructors
 
Constructors & destructors
Constructors & destructorsConstructors & destructors
Constructors & destructors
 
C++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorC++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operator
 
Constructor and Destructor
Constructor and DestructorConstructor and Destructor
Constructor and Destructor
 
Overloading in java
Overloading in javaOverloading in java
Overloading in java
 
constructor and destructor-object oriented programming
constructor and destructor-object oriented programmingconstructor and destructor-object oriented programming
constructor and destructor-object oriented programming
 
Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)
 
Constructor & Destructor
Constructor & DestructorConstructor & Destructor
Constructor & Destructor
 
Friends function and_classes
Friends function and_classesFriends function and_classes
Friends function and_classes
 
Bca 2nd sem u-2 classes & objects
Bca 2nd sem u-2 classes & objectsBca 2nd sem u-2 classes & objects
Bca 2nd sem u-2 classes & objects
 

Similar to Constructor Overloading in C++ - Create Initialized & Uninitialized Objects

Default constructors in C++
Default constructors in C++Default constructors in C++
Default constructors in C++Learn By Watch
 
constructorsfjy5ediykEASFul;IUWORHusi;gfb.pptx
constructorsfjy5ediykEASFul;IUWORHusi;gfb.pptxconstructorsfjy5ediykEASFul;IUWORHusi;gfb.pptx
constructorsfjy5ediykEASFul;IUWORHusi;gfb.pptxAshrithaRokkam
 
C++ Constructor and Destructors.pptx
C++ Constructor and Destructors.pptxC++ Constructor and Destructors.pptx
C++ Constructor and Destructors.pptxsasukeman
 
Avoid creating unncessary objects
Avoid creating unncessary objectsAvoid creating unncessary objects
Avoid creating unncessary objectsYe Win
 
CST 203 Lecture 7.pptx
CST 203 Lecture 7.pptxCST 203 Lecture 7.pptx
CST 203 Lecture 7.pptxDrKalkaDubey1
 
[OOP - Lec 13,14,15] Constructors / Destructor and its Types
[OOP - Lec 13,14,15] Constructors / Destructor and its Types[OOP - Lec 13,14,15] Constructors / Destructor and its Types
[OOP - Lec 13,14,15] Constructors / Destructor and its TypesMuhammad Hammad Waseem
 
2CPP13 - Operator Overloading
2CPP13 - Operator Overloading2CPP13 - Operator Overloading
2CPP13 - Operator OverloadingMichael Heron
 
CPP13 - Object Orientation
CPP13 - Object OrientationCPP13 - Object Orientation
CPP13 - Object OrientationMichael Heron
 
Constructor destructor.ppt
Constructor destructor.pptConstructor destructor.ppt
Constructor destructor.pptKarthik Sekar
 
Chapter 7 - Constructors.pdf
Chapter 7 - Constructors.pdfChapter 7 - Constructors.pdf
Chapter 7 - Constructors.pdfKavitaHegde4
 
Chapter 7 - Constructors.pptx
Chapter 7 - Constructors.pptxChapter 7 - Constructors.pptx
Chapter 7 - Constructors.pptxKavitaHegde4
 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of ConstructorsDhrumil Panchal
 
Effective java
Effective javaEffective java
Effective javaEmprovise
 
Run-time of Node.js : V8 JavaScript Engine
Run-time of Node.js: V8 JavaScript EngineRun-time of Node.js: V8 JavaScript Engine
Run-time of Node.js : V8 JavaScript EngineGary Yeh
 

Similar to Constructor Overloading in C++ - Create Initialized & Uninitialized Objects (20)

Default constructors in C++
Default constructors in C++Default constructors in C++
Default constructors in C++
 
constructorsfjy5ediykEASFul;IUWORHusi;gfb.pptx
constructorsfjy5ediykEASFul;IUWORHusi;gfb.pptxconstructorsfjy5ediykEASFul;IUWORHusi;gfb.pptx
constructorsfjy5ediykEASFul;IUWORHusi;gfb.pptx
 
C++ Constructor and Destructors.pptx
C++ Constructor and Destructors.pptxC++ Constructor and Destructors.pptx
C++ Constructor and Destructors.pptx
 
Avoid creating unncessary objects
Avoid creating unncessary objectsAvoid creating unncessary objects
Avoid creating unncessary objects
 
CST 203 Lecture 7.pptx
CST 203 Lecture 7.pptxCST 203 Lecture 7.pptx
CST 203 Lecture 7.pptx
 
Introduction to c ++ part -1
Introduction to c ++   part -1Introduction to c ++   part -1
Introduction to c ++ part -1
 
constructor.ppt
constructor.pptconstructor.ppt
constructor.ppt
 
[OOP - Lec 13,14,15] Constructors / Destructor and its Types
[OOP - Lec 13,14,15] Constructors / Destructor and its Types[OOP - Lec 13,14,15] Constructors / Destructor and its Types
[OOP - Lec 13,14,15] Constructors / Destructor and its Types
 
Constructor
ConstructorConstructor
Constructor
 
2CPP13 - Operator Overloading
2CPP13 - Operator Overloading2CPP13 - Operator Overloading
2CPP13 - Operator Overloading
 
CPP13 - Object Orientation
CPP13 - Object OrientationCPP13 - Object Orientation
CPP13 - Object Orientation
 
Constructors and Destructor in C++
Constructors and Destructor in C++Constructors and Destructor in C++
Constructors and Destructor in C++
 
Constructor destructor.ppt
Constructor destructor.pptConstructor destructor.ppt
Constructor destructor.ppt
 
Chapter 7 - Constructors.pdf
Chapter 7 - Constructors.pdfChapter 7 - Constructors.pdf
Chapter 7 - Constructors.pdf
 
Chapter 7 - Constructors.pptx
Chapter 7 - Constructors.pptxChapter 7 - Constructors.pptx
Chapter 7 - Constructors.pptx
 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of Constructors
 
Ahieving Performance C#
Ahieving Performance C#Ahieving Performance C#
Ahieving Performance C#
 
Session 09 - OOPS
Session 09 - OOPSSession 09 - OOPS
Session 09 - OOPS
 
Effective java
Effective javaEffective java
Effective java
 
Run-time of Node.js : V8 JavaScript Engine
Run-time of Node.js: V8 JavaScript EngineRun-time of Node.js: V8 JavaScript Engine
Run-time of Node.js : V8 JavaScript Engine
 

More from Learn By Watch

Demodulation of fm pll detector
Demodulation of fm pll detectorDemodulation of fm pll detector
Demodulation of fm pll detectorLearn By Watch
 
Demodulation of fm slope and balanced slope detector
Demodulation of fm slope and balanced slope detectorDemodulation of fm slope and balanced slope detector
Demodulation of fm slope and balanced slope detectorLearn By Watch
 
In direct method of fm generation armstrong method
In direct method of fm generation armstrong methodIn direct method of fm generation armstrong method
In direct method of fm generation armstrong methodLearn By Watch
 
Direct method of fm generation hartley oscillator method
Direct method of fm generation hartley oscillator methodDirect method of fm generation hartley oscillator method
Direct method of fm generation hartley oscillator methodLearn By Watch
 
Spectrum and power of wbfm
Spectrum and power of wbfmSpectrum and power of wbfm
Spectrum and power of wbfmLearn By Watch
 
Narrow band frequency modulation nbfm
Narrow band frequency modulation nbfmNarrow band frequency modulation nbfm
Narrow band frequency modulation nbfmLearn By Watch
 
General expression of fm signal
General expression of fm signalGeneral expression of fm signal
General expression of fm signalLearn By Watch
 
Frequency division multiplexing
Frequency division multiplexingFrequency division multiplexing
Frequency division multiplexingLearn By Watch
 
Demodulation of ssb synchronous detector
Demodulation of ssb synchronous detectorDemodulation of ssb synchronous detector
Demodulation of ssb synchronous detectorLearn By Watch
 
Generarion of ssb phase discrimination method
Generarion of ssb phase discrimination methodGenerarion of ssb phase discrimination method
Generarion of ssb phase discrimination methodLearn By Watch
 
Generarion of ssb frequency discrimination method
Generarion of ssb frequency discrimination methodGenerarion of ssb frequency discrimination method
Generarion of ssb frequency discrimination methodLearn By Watch
 
Demodulation of dsb sc costas receiver
Demodulation of dsb sc costas receiverDemodulation of dsb sc costas receiver
Demodulation of dsb sc costas receiverLearn By Watch
 
Quadrature carrier multiplexing qam
Quadrature carrier multiplexing qamQuadrature carrier multiplexing qam
Quadrature carrier multiplexing qamLearn By Watch
 
Demodulation of am synchronous detector
Demodulation of am synchronous detectorDemodulation of am synchronous detector
Demodulation of am synchronous detectorLearn By Watch
 

More from Learn By Watch (20)

Tutorial 9 fm
Tutorial 9 fmTutorial 9 fm
Tutorial 9 fm
 
Phase modulation
Phase modulationPhase modulation
Phase modulation
 
Demodulation of fm pll detector
Demodulation of fm pll detectorDemodulation of fm pll detector
Demodulation of fm pll detector
 
Demodulation of fm slope and balanced slope detector
Demodulation of fm slope and balanced slope detectorDemodulation of fm slope and balanced slope detector
Demodulation of fm slope and balanced slope detector
 
In direct method of fm generation armstrong method
In direct method of fm generation armstrong methodIn direct method of fm generation armstrong method
In direct method of fm generation armstrong method
 
Direct method of fm generation hartley oscillator method
Direct method of fm generation hartley oscillator methodDirect method of fm generation hartley oscillator method
Direct method of fm generation hartley oscillator method
 
Carson's rule
Carson's ruleCarson's rule
Carson's rule
 
Spectrum and power of wbfm
Spectrum and power of wbfmSpectrum and power of wbfm
Spectrum and power of wbfm
 
Narrow band frequency modulation nbfm
Narrow band frequency modulation nbfmNarrow band frequency modulation nbfm
Narrow band frequency modulation nbfm
 
General expression of fm signal
General expression of fm signalGeneral expression of fm signal
General expression of fm signal
 
Angle modulation
Angle modulationAngle modulation
Angle modulation
 
Frequency division multiplexing
Frequency division multiplexingFrequency division multiplexing
Frequency division multiplexing
 
Vsb modulation
Vsb modulationVsb modulation
Vsb modulation
 
Demodulation of ssb synchronous detector
Demodulation of ssb synchronous detectorDemodulation of ssb synchronous detector
Demodulation of ssb synchronous detector
 
Generarion of ssb phase discrimination method
Generarion of ssb phase discrimination methodGenerarion of ssb phase discrimination method
Generarion of ssb phase discrimination method
 
Generarion of ssb frequency discrimination method
Generarion of ssb frequency discrimination methodGenerarion of ssb frequency discrimination method
Generarion of ssb frequency discrimination method
 
Ssb modulation
Ssb modulationSsb modulation
Ssb modulation
 
Demodulation of dsb sc costas receiver
Demodulation of dsb sc costas receiverDemodulation of dsb sc costas receiver
Demodulation of dsb sc costas receiver
 
Quadrature carrier multiplexing qam
Quadrature carrier multiplexing qamQuadrature carrier multiplexing qam
Quadrature carrier multiplexing qam
 
Demodulation of am synchronous detector
Demodulation of am synchronous detectorDemodulation of am synchronous detector
Demodulation of am synchronous detector
 

Recently uploaded

Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 

Recently uploaded (20)

Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 

Constructor Overloading in C++ - Create Initialized & Uninitialized Objects

  • 2. At the end of this tutorial you will be able to • Overload a constructor. • Differentiate between initialized and uninitialized object. • Identify overloaded functions from a given c++ program. • Identify which function will execute on a call to overloaded function. • Call a constructor explicitly and implicitly. www.learnbywatch.com | yogendra@learnbywatch.com
  • 3. Constructor Overloading • Creating more than one constructors for a c++ class. • Signature of each constructor should be different. • Allow to create both initialized and uninitialized objects. www.learnbywatch.com | yogendra@learnbywatch.com
  • 4. Create an initialized object Uninitialized Object • Time t; • Time t = Time(); • Member variables are not initialized. Initialized Object • Time t(04,02,1985); • Time t = Time(04, 02, 1985); • Member variables are initialized. www.learnbywatch.com | yogendra@learnbywatch.com
  • 5. How to use Constructors? • Two ways to initialize an object by using a constructor: • An Explicit call to constructor: Time t1 = Time(12, 24, 10); • An Implicit call to constructor: Time t1(12, 24, 10); • Constructor is called whenever you create an object of a class. • The constructor creates object. • There is no object until the constructor finishes it’s work. • You can’t call a constructor with an object. www.learnbywatch.com | yogendra@learnbywatch.com
  • 6. Ask Questions to learn better Yogendra Pal www.learnbywatch.com | yogendra@learnbywatch.com