C++ Programming- Constructor (default constructor, Parametrized constructor)

Published: 28 October 2020
on channel: KUNDAN TUTORIALS
134
12

Easy way Easy to learn C++ programming in simple and easy steps way
Also includes the Syllabus of Classes XIth & XIIth.
---------------------------------------------------------------------------------------------------------------
What is constructor?
A constructor is a member function of a class which initializes objects of a class. In C++, Constructor is automatically called when object(instance of class) create. It is special member function of the class.

How constructors are different from a normal member function?
A constructor is different from normal functions in following ways: Constructor has same name as the class itself
Constructors don’t have return type
A constructor is automatically called when an object is created.
If we do not specify a constructor, C++ compiler generates a default constructor for us (expects no parameters and has an empty body).
Types of Constructors
1. Default Constructors: Default constructor is the constructor which doesn’t take any argument. It has no parameters.
2. Parameterized Constructors: It is possible to pass arguments to constructors. Typically, these arguments help initialize an object when it is created. To create a parameterized constructor, simply add parameters to it the way you would to any other function. When you define the constructor’s body, use the parameters to initialize the object.

-----------------------------------------------------------------------------------------------------------------------------------------------
LINK RELATED PROGRAMS C++ programs:https://github.com/saritaverma60/OOPs...

LINK RELATED PROGRAMS Python programs :https://github.com/saritaverma60/pyth...
LINK FOR COMPLETE PLAYLIST :   • C++ Programming - OOPs CONCEPT  
FACEBOOK LINK: https://www.facebook.com/Kundan-Tutor...

#Kundantutorials#constructor#defaultconstructor#parametrizedconstructor


On this page of the site you can watch the video online C++ Programming- Constructor (default constructor, Parametrized constructor) with a duration of hours minute second in good quality, which was uploaded by the user KUNDAN TUTORIALS 28 October 2020, share the link with friends and acquaintances, this video has already been watched 134 times on youtube and it was liked by 12 viewers. Enjoy your viewing!