Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>class BaseClass {...} public class MyClass: BaseClass {...} // Error </code></pre> <p><a href="http://msdn.microsoft.com/en-us/library/cx03xt0t.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/cx03xt0t.aspx</a></p> <p>This is mentioned in the C# language specification and also this makes perfect sense because in your case the public class can be used in "public" context with public accessibility level allowing the access of a non-public class which is your base class and this would be the wrong behaviour.</p> <p><strong>According to C# Language Specification 5.0:</strong> </p> <p>(Download the spec from <a href="http://www.microsoft.com/en-us/download/details.aspx?id=7029" rel="nofollow">http://www.microsoft.com/en-us/download/details.aspx?id=7029</a>)</p> <p><strong>The following accessibility constraints exist:</strong></p> <p>• <strong>The direct base class of a class type must be at least as accessible as the class type itself</strong>.</p> <p>• The explicit base interfaces of an interface type must be at least as accessible as the interface type itself.</p> <p>• The return type and parameter types of a delegate type must be at least as accessible as the delegate type itself.</p> <p>• The type of a constant must be at least as accessible as the constant itself.</p> <p>• The type of a field must be at least as accessible as the field itself.</p> <p>• The return type and parameter types of a method must be at least as accessible as the method itself.</p> <p>• The type of a property must be at least as accessible as the property itself.</p> <p>• The type of an event must be at least as accessible as the event itself.</p> <p>• The type and parameter types of an indexer must be at least as accessible as the indexer itself.</p> <p>• The return type and parameter types of an operator must be at least as accessible as the operator itself.</p> <p>• The parameter types of an instance constructor must be at least as accessible as the instance constructor itself.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload