Define protected class-level variable in C#.NET. It can be inherited by the classes in the same namespace.
For a protected member, access is limited within the class definition and any class that inherits from the class.
class vehicle { protected int i = 0; public void vehicleinterior() { // you can access all public, protected and private members. } }
class car : vehicle { public void carinterior() { i = 1; // it's legal because it's defined as protected in vehicle class. // here you can't access the private members of the vehicle class. } }
|