Types of Constructors A constructor can be classified into following types: Dummy constructor Default constructor Parameterized constructor Copy constructor Dynamic constructor Dummy Constructor When no constructors are declared explicitly in a C++ program, a dummy constructor is invoked which does nothing. So, data members of a class are not initialized and contains garbage values. Following program demonstrates a dummy constructor: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #include <iostream> using namespace std; class Student { private: string name;
The post what are types of constructors in C++ appeared first on Coding Security.
what are types of constructors in C++
read more
Tidak ada komentar:
Posting Komentar