Posts

Showing posts from May, 2020

Abstract class and Method

Abstract Class: An abstract class is a special type of class that cannot be instantiated. An abstract class is designed to be inherited by subclass. you can create abstract class by using abstract keyword. Note: You cannot create instance of abstract class Example: public abstract class Base_Employee {      public string First_Name{get;set;}      public string Last_Name{get;set;}     public string GetFullName(){         return this.First_Name +" " + this.Last_Name     }     public abstract int GetSalary(); //Once you define Abstract Method, it must override in child class. } public class Employee:Base_Employee {       public int override GetSalary()      {           return 12000;      } } Now, if you try to create instance of Base_Employee then it will not allowed you to do that. usually people used abstract c...