Saturday 1 September 2007

Why constructor in c++

(q) Why constructor ?
Ans:
Goal 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; //intialization at the time
char b='v'; // of creation

No comments:

Post a Comment