The Default Access Modifiers
By default, type members are implicitly private while types are implicitly internal. Thus, the
following class definition is automatically set to internal, while the type’s default constructor is
automatically set to private:
// An internal class with a private default constructor.
class Radio
{
Radio(){}
}
Thus, to allow other types to invoke members of an object, you must mark them as publically
accessible. As well, if you wish to expose the Radio to external assemblies (again, useful when build-
ing .NET code libraries; see Chapter 15) you will need to add the public modifier.
Do'stlaringiz bilan baham: |