# base keyword:- It basically used to access constructors and methods of the base class. The base keyword cannot use within a static method.
Use of Base keyword:-
·Call the method of base class that has been overridden by another method.or Base keyword call the hidden method of base class in the derived class.
{
public virtual void basePrint()
Console.WriteLine("I am in base class");
}
class DeriveClass:BaseClass
{
public override void basePrint()
Console.WriteLine("I am in derived class");
static void Main()
DeriveClass obj = new DeriveClass();
//obj1.basePrint();
}
}
Solution:-
public override void basePrint()
base.basePrint();
Example:-
public partial class EmployeeContext : DbContext
public EmployeeContext(): base("name=AppConnection")
}
}
No comments:
Post a Comment