Class and typedef Names

In C++, a class and a typedef cannot both use the same name to refer to a different type within the same scope (unless the typedef is a synonym for the class name).

In C, a typedef name and a struct tag name declared in the same scope can have the same name because they have different name spaces. For example:

void main ()
{
     typedef double db;
     struct db; // error in C++, valid in ISO/ANSI C

     typedef struct st st; // valid ISO/ANSI C and C++
}