"Eugene Alterman" <Eu*************@autodesk.com> wrote in message
news:Qp******************@newssvr32.news.prodigy.c om...
"Gianni Mariani" <gi*******@mariani.ws> wrote in message
news:br********@dispatch.concentric.net... typedef x y;
Now, x and y are exactly the same. However, y is really class x.
They are not exactly the same.
While you can declare x in a forward declaration as a class, you cannot do
the same for y:
class x; // ok
class y; // error
Yes, and this can be a pain sometimes. It would be nice if the language did not take 'class y'
literally (a little like 'class' as a template argument), and instead as just 'some type' for
the purpose of declaring pointers or references, or whatever the forward declaration is for. If
'y' turns out to be some incompatible type, such as a reference, the compiler can catch it
later, just as does now if 'y' turns out to be a struct rather than a class.
DW