What is the output of this code segment ?
using System;

class A
{
A()
{
Console.WriteLine("Class A");
}
}

class B:A
{
B()
{
Console.WriteLine("Class B");
}
static void Main()
{
B obj=new B();
}
}

The options are:
1) Class A
Class B
2) Class B
Class A
3)None of these

4) error message

 Posted by Ddd on 1/20/2011 | Category: C# Interview questions | Views: 6713 | Points: 40
Select from following answers:
  1. Option 1
  2. Option 2
  3. Option 3
  4. Option 4
  5. All Above

Show Correct Answer


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Ck.kislay on: 1/21/2011 | Points: 10
Explanation:

Error because, Child constructor going to call Base class constructor and the Base class constructor have private Access specifier.
( If one not mention Access Specifier it becames Private) Thanks,
Chandan

Login to post response