U
uralmutlu
Hi,
I was wandering if I can have classes in unions?
I basically have source code in a format very similar to:
union example {
ClassA variable1;
ClassB variable2;
};
class AnotherClass {
.....
example SomeName;
.....
};
However, the compiler (gcc) tells me constructors aren't allowed in
unions.
I have a very large program written for eg ClassA, and I am adding a
second class, eg ClassB, to it. I came to this particular code, and I
thought unions would be an easy solution, but it looks like I will have
to make other changes.
I thought since classes are types they would be allowed in unions.
so no classes in unions?
regrads
I was wandering if I can have classes in unions?
I basically have source code in a format very similar to:
union example {
ClassA variable1;
ClassB variable2;
};
class AnotherClass {
.....
example SomeName;
.....
};
However, the compiler (gcc) tells me constructors aren't allowed in
unions.
I have a very large program written for eg ClassA, and I am adding a
second class, eg ClassB, to it. I came to this particular code, and I
thought unions would be an easy solution, but it looks like I will have
to make other changes.
I thought since classes are types they would be allowed in unions.
so no classes in unions?
regrads