Page 27 : 40
Object-oriented Programming in C#
Specialization, Extension, and Inheritance
* Specialization of Classes
Specialization of Classes
The extension of class specialization
Example: Bank Accounts
Example: Bank Accounts in C#
Example: Geometric Shapes
Specialization of classes
The Principle of Substitution
* Extension of Classes
Extension of Classes
An example of simple extension
The intension of class extensions
* Inheritance in General
Inheritance
Interfaces to clients and subclasses
Visibility and Inheritance
Class hierarchies and Inheritance
Multiple inheritance
Problems with multiple inheritance
* Inheritance in C#
Class Inheritance in C#
The top of the class hierarchy
Methods in the class
Object
in C#
Inheritance and Constructors
Constructors and initialization order
Constructors and initialization order: Example
Visibility modifiers in C#
Inheritance of methods, properties, and indexers
Inheritance of methods: Example.
Overriding and Hiding in C#
Polymorphism. Static and dynamic types
Static and dynamic types in C#
Type test and type conversion in C#
Examples of type test and type conversion
Virtual methods in C#
Practical use of virtual methods in C#
Overriding the Equals method in a class
Upcasting and downcasting in C#
Upcasting and downcasting in C#
Inheritance and Variables
Visibility modifiers in C#
The visibility of types in assemblies and members in classes are controlled by visibility modifiers
Visibility of a type (e.g. a class) in an assembly
internal
: The type is not visible from outside the assembly
public
: The type is visible outside the assembly
Visibility of members in type (e.g., methods in classes)
private
: Accessible only in the containing type
protected
: Accessible in the containing type and in subtypes
internal
: Accessible in the assembly
protected internal:
Accessible in the assembly and in the containing type and its subtypes
public
: Accessible whenever the enclosing type is accessible
Namespaces and assemblies
Private Visibility and inheritance
Internal Visibility