Heres the code:
#include
#include
using namespace std;
class classA
{
protected:
v
An empty constructor is provided by default: this is correct. But if you redefine it, it's not a default constructor any more. You have to declare and define it. If you only declare it (without the body), it's incorrect: you have to define it as well. If you define it without a declaration in the class, it's an error as well. You can though, "combine" declaration and definition by writing as follows:
class classA
{
// ....
public:
classA() { p = 0;}
};
or in this case even better:
class classA
{
// ....
public:
classA():p(0) {}
};