anonymous ctor?

  • Thread starter .rhavin grobert
  • Start date
R

.rhavin grobert

in anonymous unions you can overload the operators
(at least, it seems to work with my compiler;-), but ...

union {
//whatever
operator= (...);
} foo;

.... is there a way to overload the ctor?
 
J

jason.cipriani

in anonymous unions you can overload the operators
(at least, it seems to work with my compiler;-), but ...

union {
  //whatever
  operator= (...);

} foo;

... is there a way to overload the ctor?

You can't have an anonymous union with member functions, even if your
particular compiler lets you do it (it shouldn't).

The simple solution may be to not use an anonymous union.

union FooUnion {
//whatever
FooUnion ();
operator= (...);
} foo;

Jason
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,197
Messages
2,571,041
Members
47,634
Latest member
Alba16710

Latest Threads

Top