mardi 28 février 2017

Placing class constructor

Why this code is incorrect?

class Method
{
public:
   Method(decltype(info2) info1);
   virtual ~Method(){}
protected:
  QSharedPointer<info> info2;
};

But this code is correct:

class Method
{
public:
   virtual ~Method(){}
protected:
  QSharedPointer<info> info2;
public:
  Method(decltype(info2) info1);   
};

why place of class constructor is important? I thought that place of definition class constructor isnt important.

Aucun commentaire:

Enregistrer un commentaire