lundi 23 novembre 2015

Initializing a static member with a random value [on hold]

class A{
        int a;
    public:
        A(int inA = 0);
        int getA;
    protected:
        void setA(int inA);
    };
A::A(int inA)
    {
        setA(inA)
    }
void A::setA(int inA){
        //need to set a as static random number
        a = inA;
    }
int A::getA()const
    {
        return a;
    }

How could I possibly generate a random using a static member for a? I have seen something like this online: Random Number In-Class Initialisation but not really sure how to use it.




Aucun commentaire:

Enregistrer un commentaire