In C++, an unimplemented default constructor does nothing. If you declare and implement the default constructor, you can:
class CheckGarbage
{
private:
int rollNo;
float cgpa;
char* name;
public:
CheckGarbage()
{
rollNo = 0;
cgpa = 0;
name = NULL;
}
void checkValue()
{
cout<<"Roll no : " <<rollNo <<endl;
cout<<"CGPA : " <<cgpa <<endl;
cout<<"name : " <<name <<endl;
}
};
There isn't really an idea of a default value for particular data types in C++, like in some other langauges. What you may be actually referring to, is the default value of a parameter, like so:
CheckGarbage(int r = 0, float c = 0, n = NULL)
{
rollNo = r;
cgpa = c;
name = n;
}
You can read more on them here or here. A constructor with default values for all parameters, takes on the role of the default constructor.