Which of the following statement is correct with respect to the below code snippet?
namespace MyConsoleApplication
{
class index
{
protected int count;
public index()
{
count = 0;
}
}
class index1: index
{
public void increment()
{
count = count +1;
}
}
class MyProgram
{
static void Main(string[] args)
{
index1 i = new index1();
i.increment();
}
}
}
1.count should be declared as public if it is to become available in the inheritance chain.
2.count should be declared as protected if it is to become available in the inheritance chain.
3.While constructing an object referred to by i firstly constructor of index class will be called followed by constructor of index1 class.
4.Constructor of index class does not get inherited in index1 class.

 Posted by Kmandapalli on 1/15/2014 | Category: C# Interview questions | Views: 3669 | Points: 40
Select from following answers:
  1. 1, 2 3
  2. 2, 3, 4
  3. 3, 4
  4. All the above
  5. All Above

Show Correct Answer


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response