Wednesday, September 9, 2009

Constructor in c++


(q) Why constructor in c++?


Answer:
One of the goals of c++ is to create such type of class which is very similar to basic data type like int, char, float etc. It is possible in basic data type like int, char etc we can initialize the data type at the time of creation.


Example:
#include

#include

int main()

{

int a=6; //initialization at the time

No comments:

Post a Comment