home *** CD-ROM | disk | FTP | other *** search
- %F,15,COMMONC.MNU%Constructs_in_C_and_C++ / %F,15,COMMONC.2%Previous / %F,15,COMMONC.4%Next
-
- %C,1%Class and typedef Names
-
- In C++, a class and a %C,1%typedef%C,5% cannot both use the same name
- to refer to a different type within the same scope (unless
- the %C,1%typedef%C,5% is a synonym for the class name). In C, a
- %C,1%typedef%C,5% name and a %C,1%struct%C,5% tag name declared in the same
- scope can have the same name because they have different name
- spaces. For example:
-
- %C,1%void %C,5%main %C,1%() {
- %C,1%typedef double %C,5%db%C,1%;
- %C,1%struct %C,5%db%C,1%;%C,14% // error in C++, valid in ANSI C
- %C,1%typedef struct %C,5%st st%C,1%;%C,14% // valid ANSI C and C++
- %C,1%}
-
-