vendredi 24 juillet 2015

is there another simple way to do with c++ property

I've tried to use c++ property and now i'm stuck with this:

class a {
    protected:
        // wikipedia http://ift.tt/1LIYGK0
        template<class s, typename t>
        class getonly {
            protected:
                friend s;
                t value;
                t set(); // operator =...
            public:
                t get(); // t operator...
        };
};

class b : public a {
    public:
        getonly<b, int> id;
};

now I want something like this:

class b : public a {
    public:
        getonly<int> id;
};

can anyone help me! English is not my first language so sorry about the mistakes!

Aucun commentaire:

Enregistrer un commentaire