Inheritance

0%

Base(Parent) class can access the member of child class?

Correct! Wrong!

What will be the output of the following C# code? using System;

public class BaseClass
{
public BaseClass()
{
Console.WriteLine("Base class");
}
}

public class ChildClass : BaseClass
{
public ChildClass()
{
Console.WriteLine("Child class");
}
static void Main()
{
ChildClass CC = new ChildClass();
}
}

Correct! Wrong!

Child class can access base class private member

Correct! Wrong!

In an inheritance chain which of the following members of base class are accessible to the derived class members?

Correct! Wrong!

How to prevent inheritance from a class in C# ?

Correct! Wrong!

In C#, Which keyword is used to refer base class constructor from child class constructor?

Correct! Wrong!

Which of the following members of base class are accessible to derived class members?

Correct! Wrong!

Which form of inheritance is not supported directly by C#?

Correct! Wrong!

What is output of below code? using System;

public class BaseClass
{
private int ii = 10;
public int iiNum = 20;
}
public class ChildClass : BaseClass
{

public int ii = 5;
}

public class Program
{
static void Main()
{
ChildClass childClass = new ChildClass();
Console.WriteLine($"{childClass.ii + childClass.iiNum}");
Console.ReadLine();
}
}

Correct! Wrong!

What is the output of below program?
using System;

public class BaseClass
{
public int ii = 10;
public int iiNum = 20;
}
public class ChildClass : BaseClass
{

public int ii = 5;

public void Print()
{
Console.WriteLine($"{base.ii + iiNum}");
}
}

public class Program
{
static void Main()
{
ChildClass childClass = new ChildClass();
childClass.Print();
Console.ReadLine();
}
}

Correct! Wrong!

Inheritance
Result
Beginner!
You need to work hard, Here is a tutorial on Inheritance
Result
Intermediator!
You are good but there is work to be done Here is a tutorial on Inheritance
Result
Pro!
You are good, Here is a tutorial on Inheritance

Leave a Reply

Your email address will not be published. Required fields are marked *