C# Programming - Inheritance
Exercise : Inheritance - General Questions
- Inheritance - General Questions
- Inheritance - True or False
11.
Which of the following should be used to implement a 'Like a' or a 'Kind of' relationship between two entities?
12.
How can you prevent inheritance from a class in C#.NET ?
Answer: Option
Explanation:
C#.NET allows sealed attribute to be used as a part of class statement. Classes declared with sealed keyword cannot be used as based class for other classes. Most important reason to do this world be to prevent behavior of a class to be changed in any way.
13.
Which of the following statements are correct about Inheritance in C#.NET?
- A derived class object contains all the base class data.
- Inheritance cannot suppress the base class functionality.
- A derived class may not be able to access all the base class data.
- Inheritance cannot extend the base class functionality.
- In inheritance chain construction of object happens from base towards derived.
14.
Assume class B is inherited from class A. Which of the following statements is correct about construction of an object of class B?
15.
Which of the following statements is correct about the C#.NET program given below?
namespace IndiabixConsoleApplication
{
class Baseclass
{
int i;
public Baseclass(int ii)
{
i = ii;
Console.Write("Base ");
}
}
class Derived : Baseclass
{
public Derived(int ii) : base(ii)
{
Console.Write("Derived ");
}
}
class MyProgram
{
static void Main(string[ ] args)
{
Derived d = new Derived(10);
}
}
}
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers