C# object-oriented programming
↑Use encapsulation to protect invariants and interfaces to express contracts. Learn how access modifiers and static members affect dependencies before building complicated hierarchies.
Lessons and practical examples
Section titled “Lessons and practical examples”-
Abstract classes and interfaces: Abstraction, interface contracts, multiple interfaces and implementation choices.
-
Access modifiers explained: public, private, protected, internal, protected internal, private protected and file.
-
Classes, objects and constructors: Objects, fields, class members, constructors, files and partial classes.
-
Inheritance and polymorphism: Base classes, derived classes, virtual, override, base and polymorphic calls.
-
Properties and encapsulation: get, set, init, private set, auto-properties and validation.
-
Static, const and readonly: What public static int means, shared fields, compile-time constants and read-only state.
How to study this section
Section titled “How to study this section”Start with one concept, work through a small example, and verify your prediction. Follow linked topics when a prerequisite or related idea needs more explanation.
