Friday, February 5, 2010

Difference between struct and class in terms of Access Modifier

All members of a class are private by default, whereas fields of a struct are public. Default access of a base class is private for classes and public for structures.
For Example 
struct Emp {
       char Name[20]; // Here Name variable is public 
};

0 Comments: