Minggu, 30 Oktober 2016

Different types of constructors in Programming

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; string regdno; int age;

The post Different types of constructors in Programming appeared first on Coding Security.


Different types of constructors in Programming
read more

Tidak ada komentar:

Posting Komentar