|
|
|
|
| |
[027] Delegate |
26/01/2018 |
|
Delegate is able to point on methods with the same signature as the delegate definition.
In the next code we can see the use of delegate by handling the OnClick event of a Button control that calls to an unknown number of methods by calling the instance of the delegate. |
|
Download: Source Code | Explanation |
|
|
|
| |
[028] Inheritance |
26/01/2018 |
|
Inheritance enables to one class to inherite from other class.
Classes inheritance includes a base classs and a derived class that inherit from the base class.
The derived class inherits all the un-private members of the base class.
In the next code we can see inheritance between a derived class named Student and a base class names Person. |
|
Download: Source Code |
|
|
|
| |
[029] Polymorphism |
26/01/2018 |
|
Polymorphism enables implementing a method by the type of an object and calling to his methods accordingly to his type.
In the next code we can see how to get an area from some shapes by calling the same method of each object using a virtual method called Area and overriding the method in each object. |
|
Download: Source Code | Explanation |
|
|
|
| |
[030] Interfaces |
26/01/2018 |
|
Interface enables defining a common behavior to an objects that implement the interface.
In the next code we can see an example of polymorphism by using Interfaces. |
|
Download: Source Code | Explanation |
|
|
|
| |
[031] base statement |
21/04/2013 |
|
The base keyword enables derived class to access to a non-static members in the base class.
In the next code, we can see how to call to method in the base class named Person from the derived class named Student using the base keyword. |
|
|
|
|
|
|
| |
|
|