Discussion :: Inheritance
-
Which of the following statements are correct about the C#.NET code snippet given below?
namespace FresherGateConsoleApplication { 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(); } } }
- count should be declared as public if it is to become available in the inheritance chain.
- count should be declared as protected if it is to become available in the inheritance chain.
- While constructing an object referred to by i firstly constructor of index class will be called followed by constructor of index1 class.
- Constructor of index class does not get inherited in index1 class.
- count should be declared as Friend if it is to become available in the inheritance chain.
Answer : Option B
Explanation :
No answer description available for this question.
Be The First To Comment