Interviews2 answers
Which constructor call first
2 Answers
Constructor calling follow top to down approach.
So constructor of Parent calls first and then child.
Devesh OmarPosted Jan 8, 2014, 9:17 PM EST
I Have two classes
calss Parent
{
public Parent()
{
console.wl("parent cons");
}
}
Class Child : Parent
{
public Child ()
{
console.wl("Parent cons");
}
Static Void Main()
{
child obj=new child();
console.readline();
}
}
Which constructor calls first? and Why?
akrao kotiPosted Jun 6, 2013, 1:53 AM EDT

