[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: GCC 4.3 C++ question



On Saturday 09 February 2008 18:23:24 Tim Niemueller wrote:
> Paul Black wrote:
> > Why not:
> > class SomeClass
> > {
> >  public:
> >   SomeClass();
> >   // more stuff...
> >  protected:
> >   struct mylist_t {
> >     mylist_t *next;
> >     void *dataM
> >   };
> > };
>
> Then I cannot use
>   SomeClass::mylist_t *list
> but I would have to use
>   struct SomeClass::mylist_t *list
> which is ugly and this is why I had the typedef in the first place.

That is only true in C.  In C++, struct/union/enum/class names are 
automatically typenames.

> I just wonder if this is indeed the intended behavior, typedef are not
> allowed as members,

I am not familiar; usually you see typedefs at the global or namespace scope, 
and usually they follow the class or struct declaration.

-- Benjamin Kreuter



-- 
Message sent on: Sat Feb 9 18:29:30 EST 2008

Attachment: signature.asc
Description: This is a digitally signed message part.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]