P
Pierre Couderc
I want to share enum between 2 classes C1 and C2:
class C1
{
public:
enum shut {AAA,BBB, CCC};
shut m_C1;
void set(shut &s) { m_C1=s;}
};
class C2 : public Cother
{
public:
enum shut {AAA,BBB, CCC};
shut m_C2;
};
void main()
{
C1 a;
C2 b;
a.set(AAA);
b.m_C2 = a.m_C1;
}
Is there a more elegant way than the one I have found, but for which I
do not measure the side effects :
class Cenum
{
public:
enum shut {AAA,BBB, CCC};
};
class C1 : public Cenum
{
public:
shut m_C1;
void set(shut &s) { m_C1=s;}
};
class C2 : public Cother, Cenum
{
public:
shut m_C2;
};
class C1
{
public:
enum shut {AAA,BBB, CCC};
shut m_C1;
void set(shut &s) { m_C1=s;}
};
class C2 : public Cother
{
public:
enum shut {AAA,BBB, CCC};
shut m_C2;
};
void main()
{
C1 a;
C2 b;
a.set(AAA);
b.m_C2 = a.m_C1;
}
Is there a more elegant way than the one I have found, but for which I
do not measure the side effects :
class Cenum
{
public:
enum shut {AAA,BBB, CCC};
};
class C1 : public Cenum
{
public:
shut m_C1;
void set(shut &s) { m_C1=s;}
};
class C2 : public Cother, Cenum
{
public:
shut m_C2;
};