home *** CD-ROM | disk | FTP | other *** search
- %F,15,COMMONC.MNU%Constructs_in_C_and_C++ / %F,15,COMMONC.3%Previous / %F,15,COMMONC.5%Next
-
- %C,1%Class and Scope Declarations
-
- In C++, a class declaration introduces the class name into the
- scope where it is declared and hides any object, function, or
- other declaration of that name in an enclosing scope. In ANSI C,
- an inner scope declaration of a %C,1%struct%C,5% name does not
- hide an object or function of that name in an outer scope.
- For example:
-
- %C,1%double %C,5%db%C,1%;
- %C,1%void %C,5%main %C,1%() {
- %C,1%struct %C,5%db %C,14%// hides double object db in C++
- %C,1%{ char* %C,5%str%C,1%; };
- %C,1%int %C,5%x %C,1%= sizeof(%C,5%db%C,1%);%C,14% // size of struct in C++
- %C,14% // size of double in ANSI C
- %C,1%}
-
-