Home > Software engineering >  Why compile don't in the past?
Why compile don't in the past?

Time:09-28

# include & lt; Iostream. H>

Class c
{
(c)
{
Cout<" The base class constructor \ n "& lt; }
~ (c)
{
Cout<" Base class destructor \ n "& lt; }
};

Class d: public c
{
(d)
{
Cout<" The derived class constructor \ n "& lt; }
~ d ()
{
Cout<" The derived class destructor \ n "& lt; }

};


Void main ()
{
C m_object;
}

CodePudding user response:


Questions using normalized routine code is the basic respect to answer the question...
 # include & lt; Iostream>//should be here no. J h, will. H to remove 

Class c
{
(c)
{
Cout<" The base class constructor \ n "& lt; }
~ (c)
{
Cout<" Base class destructor \ n "& lt; }
};

Class d: public c
{
(d)
{
Cout<" The derived class constructor \ n "& lt; }
~ d ()
{
Cout<" The derived class destructor \ n "& lt; }

};


Void adaptive ()
{
C m_object;
}

CodePudding user response:

# include & lt; Iostream> //removed. H
using namespace STD.//sure use namespace

Class c
{
public://sets the constructor and destructor to public, default is private
(c)
{
Cout<" The base class constructor \ n "& lt; }
~ (c)
{
Cout<" Base class destructor \ n "& lt; }
};

Class d: public c
{
public://sets the constructor and destructor to public, default is private
(d)
{
Cout<" The derived class constructor \ n "& lt; }
~ d ()
{
Cout<" The derived class destructor \ n "& lt; }

};


Void main ()
{
C m_object;
}
More 0

CodePudding user response:

Class default property is private, can not be outside of class members to visit
  • Related