#229 – The Core Principles of Object-Oriented Programming
February 1, 2011 4 Comments
As an object-oriented language, C# supports the three core principles of object-oriented programming:
- Encapsulation – Hide implementation details in a class from users of the class, exposing only a public interface
- Inheritance – Derive a subclass from a parent class, inheriting data and behavior from the parent, in an “is-a” relationship. Inheritance defines a hierarchy of classes. All classes ultimately inherit from System.Object.
- Polymorphism – Any subtype may be used where a parent type (or type higher up in the class hierarchy) is expected. Conversely, a variable of a particular class will be treated as the appropriate subclass.
Pingback: #251 – Class Properties Support the Principle of Encapsulation « 2,000 Things You Should Know About C#
Pingback: #685 – Inheritance Can Break Encapsulation « 2,000 Things You Should Know About C#
Pingback: #697 – Encapsulation is Managed through the Use of Access Modifiers « 2,000 Things You Should Know About C#
Abstraction is missing.