Q&A
Q. What are the four primary principles of object-oriented programming?
A. The four primary principles of object-oriented programming are encapsulation, abstraction, inheritance, and polymorphism.
Q. Why are encapsulation and abstraction important?
A. By using encapsulation and abstraction, you can change internal implementation details without affecting already-written code that uses that class.
Q. What is method overloading?
A. Method overloading is creating more than one method of the same name in a given type. Overloaded methods must have different signatures.
Q. How do properties enable a class to meet the goals of encapsulation?
A. A property provides a simple way to access a field that can be publicly available while still allowing the internal details of that field to be hidden.
Q. What are partial classes?
A. A partial class contains the keyword partial on all class declarations and is typically split across multiple source code files.
Q. What is the benefit of using extension methods?
A. Using extension methods enables additional functionality to be added to an existing type without requiring the use of inheritance. This additional functionality can then be used in a natural and intuitive way.