Minggu, 20 November 2016

An introduction to constructors in Programming

Until now in our C++ programs, we are initializing the data members of a class by creating one or more member functions and passing values as parameters to those functions. We know that C++ considers user-defined types on par with pre-defined types. We can initialize a pre-defined type at the time of declaration itself as shown below:   int x = 20;   Similarly, to initialize the data members when an object is created, C++ provides a special member function called a constructor and to de-initialize an object, another special member function called a destructor is used.   Constructor  

The post An introduction to constructors in Programming appeared first on Coding Security.


An introduction to constructors in Programming
read more

Tidak ada komentar:

Posting Komentar