If A is the base class and B inherits B and C inherits B and an object is created for C , then what will be the order of
the constructor being called?
A then B then C.
using System;
using System.Collections.Generic;
using System.Text;
namespace OopTest5
{
class A
{
public A()
{
Console.Out.Write("A");
}
}
class B : A
{
public B()
{
Console.Out.Write("B");
}
}
class C : B
{
public C()
{
Console.Out.Write("C");
}
}
class Program
{
static void Main(string[] args)
{
C c = new C();
Console.In.Read();
}
}
}
Subscribe to:
Post Comments (Atom)
0 comments
Post a Comment