Both methods assign the argument values to the appropriate data members of the class. If you do not explicitly initialize a base class or member that has constructors by calling a constructor, the compiler automatically initializes the base class or member with a default constructor .
Read moreWhat is a class initialization?
A class initialization block is a block of statements preceded by the static keyword that’s introduced into the class’s body . When the class loads, these statements are executed.
Read moreHow do I initialize a class in C++?
There are two ways to initialize a class object:
Read moreHow do you initialize a class object?
Creating an Object
Read moreWhat are the components essentially needed to define a class?
There are three major components of class in Java.
Read moreWhat is default constructor called in C++?
A constructor is automatically called when an object is created . It must be placed in public section of class. If we do not specify a constructor, C++ compiler generates a default constructor for object (expects no parameters and has an empty body).
Read more