I have the following scenario. I subclassing and would like to know what happens to the superclass after the child class is gone
Following is my implementation:
class Program
{
static void Main(string[] args)
{
using (var a = new SuperHuman())
{
}
Console.ReadLine();
}
}
class Human : IDisposable
{
public string LoType = "Normal";
public Human()
{
Console.WriteLine("Human Created");
}
public string GetHumanType()
{
return LoType;
}
public void Dispose()
{
Console.WriteLine("{0} Human Class gONE", LoType);
}
}
class SuperHuman : Human
{
public SuperHuman()
{
LoType = "Super";
Console.WriteLine("{0} Human Created",LoType);
}
}
gives me the following Output:
Human Created
SuperHuman Created
SuperHuman Class Gone
What I would like to know is if the Parent class is gone as well if not how do I dispose it along with the child class?