home *** CD-ROM | disk | FTP | other *** search
/ Microsoftware Monthly 19…2 Programming Power Tools / MASO9512.ISO / cpptutor / cpptutor.arj / TEXT / COMMONC.4 < prev    next >
Encoding:
Text File  |  1993-11-06  |  802 b   |  20 lines

  1. %F,15,COMMONC.MNU%Constructs_in_C_and_C++ / %F,15,COMMONC.3%Previous / %F,15,COMMONC.5%Next
  2.  
  3.                %C,1%Class and Scope Declarations
  4.  
  5. In C++, a class declaration introduces the class name into the
  6. scope where it is declared and hides any object, function, or
  7. other declaration of that name in an enclosing scope.  In ANSI C,
  8. an inner scope declaration of a %C,1%struct%C,5% name does not
  9. hide an object or function of that name in an outer scope.
  10. For example:
  11.  
  12.    %C,1%double %C,5%db%C,1%;
  13.    %C,1%void %C,5%main %C,1%() {
  14.      %C,1%struct %C,5%db %C,14%// hides double object db in C++
  15.      %C,1%{ char* %C,5%str%C,1%; };
  16.      %C,1%int %C,5%x %C,1%= sizeof(%C,5%db%C,1%);%C,14% // size of struct in C++
  17.                         %C,14% // size of double in ANSI C
  18.    %C,1%}
  19.  
  20.