Since you are using inheritance here, you don't need to create the object of
ClassA
. In the case of inheritance all the methods of Parent Class (in your case
ClassA
) will be accessible in child class(in your case
ClassB
). Hence, you can directly call the function of
ClassA
in
ClassB
, Like:
public class ClassB : ClassA
{
public void MethodB()
{
Console.WriteLine("Class B Method Called");
MethodA();
}
}
--Amit