-
class CL
{
private //missing
int a;
float x=4.5; //cannot initialize member data.
public
void CL(int a, float b=0.0); //constructor does not have
//return type.
PrintCl(void);
//missing;
}
-
class CL
{
private //missing
int data;
public
CL(int n=5);
void Update(int m) const; //update method cannot be a constant method
};
CL;CL(int n=5):n(data) //should be class scope operator::
{} // do not repeat default n=5; assignment is data(n)
void CL;Update(int m) const //should be class scope operator ::
{
data=m; //not a constant method
}
-
class CL
{ // add public otherwise the constructor is private
CL(int x):data(x)
{}
private:
int data;
};