This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
/* Explicit Interface Implementation | |
* | |
* When you are explicitly implementing an interface member, you are not allowed to use an access modifier | |
* | |
* You have to use the interface name dot MethodName, ex. IInterface1.InterfaceMethod(); | |
* | |
* When a class explicitly implements an interface member, the interface member can no longer be accessed through a | |
* class reference variable, but instead can only be accessed via the interface reference variable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
/* Not all programming languages use Properties | |
* | |
* Getter and Setter methods are used to encapsulate and protect fields | |
* | |
*/ | |
public class Student |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
/* Inner Exception Notes | |
* | |
* The InnerException property returns the Exception instance that caused the current exception | |
* | |
* To retain the original exception, pass it as a parameter to the constructor of the current exception | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
/* //Interface Basics// | |
* | |
* Interfaces can contain properties, methods, delegates or events but ONLY the declarations. NOT implementations. | |
* | |
* Interface members are public by default and DO NOT allow explicit access modifiers | |
* | |
* Interfaces CANNOT contain fields | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
//the goal for this Employee class is to have no hard coded logic within the class. We can accomplish this using a delegate and a single LAMBDA expression on Line 42 | |
public class Employee | |
{ | |
public int ID { get; set; } | |
public string Name { get; set; } | |
public int CurrentSalary { get; set; } | |
public int YearsExperience { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
/* Method Overriding and Method Hiding | |
* | |
* In method overriding, a base class reference variable pointing to a child object will invoke the overriden method in the child class | |
* | |
* In method hiding, a base class reference variable pointing to a child class object will invoke the hidden method in the base class | |
* | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
/* Multicast Delegates | |
* | |
* A multicast delegate is a delegate that has a reference to more than one function. | |
* When you invoke a multicast delegate, all of the functions the delegate is pointing to are invoked. | |
* | |
* There are 2 approaches to create a multicast delegate (multiple instances, or the same instance) | |
* 1. + or += to register a method with the delegate (SEE APPROACH ONE) | |
* 2. - or -= to un-register a method with a delegate (SEE APPROACH TWO) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
interface IA | |
{ | |
void AMethod(); //declare method | |
//method implemented in class A | |
} | |
public class A : IA //inherit from interface A | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class ParentClass | |
{ | |
public ParentClass() //parameterless constructor, this will be overloaded if the ParentClass constructor is called with a string argument | |
{ | |
Console.WriteLine("ParentClass Constructor called"); | |
} | |
public ParentClass(string Message) //method overloads parameterless ParentClass constructor if ParentClass constructor is called with a string argument |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
/* Polymorphism with virtual and override | |
* | |
* Base class reference variables can point to a child class object | |
* | |
* !@!@ Polymorphism enables us to invoke derived class methods using a base class reference variable at RUN-TIME !@!@ | |
*/ | |
public class Employee |