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

Publié le: 28 October 2020
sur la chaîne: 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


Sur cette page du site, vous pouvez voir la vidéo en ligne C++ Programming- Constructor (default constructor, Parametrized constructor) durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur KUNDAN TUTORIALS 28 October 2020, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 134 fois et il a aimé 12 téléspectateurs. Bon visionnage!