vendredi 1 janvier 2016

need to define all available constructor forms in c++

I have a class like this:

class A{
    private:
        init(const std::string s=""){/*do something*/}
    public:
        A(){init();}
        A(const A&){init();}
        A(const std::string s){init(s);}
        A(const A&, const std::string s){init(s);}
};

Does it cover all the forms that constructors may be called?

What I am trying to do is, any object creation must call the init() function at first.

Aucun commentaire:

Enregistrer un commentaire