Can we inherit an abstract class in another abstract class.
If no why and If yes how..?

Answers were Sorted based on User's Feedback



Can we inherit an abstract class in another abstract class. If no why and If yes how..?..

Answer / anonymous

Yes we can Inherit abstract class into another abstract
class just like we inherit any other class. Since the
Inheriting class is also an Abstract class so there is also
no need to override the parent class methods.

Example:

namespace AbstractNamespace
{
public class AbstractClass1 //Parent Abstract Class
{
public abstract string MyFunction1();
}

public class AbstractClass2 : AbstractClass1 //Child
Abstract Class
{
public abstract string MyFunction2();
}

public class TestAbstractClasses : AbstractClass2
{
//Here you will need to override both the functions
//MyFunction1() and MyFunction2()
}
}

Is This Answer Correct ?    14 Yes 2 No

Can we inherit an abstract class in another abstract class. If no why and If yes how..?..

Answer / sudipta

Yes, we can inherit an abstract class in another abstract
class.

Suppose we have two abstract class.one is parent and
antoher is child.

namespace ClassCollection
{
abstract class Absparent
{
public abstract void Method1();

}

abstract Class AbsChield: Absparent
{
public abstract void Method2();

}

public Class ImplementedClass: AbsChield
{
here we can get two methods of abstact class
(Absparent,AbsChield)

public override void Method1()
{

}

public override void Method2()
{

}


}


}

Is This Answer Correct ?    9 Yes 0 No

Post New Answer

More C Sharp Interview Questions

What is the file extension for c#?

0 Answers  


Can you declare a class or a struct as constant?

0 Answers  


Why do you call it a process? What’s different between process and application in .net, not common computer usage, terminology?

0 Answers  


How do you determine whether a string represents a numeric value?

0 Answers  


What are Uses of CLR

0 Answers   TCS,


What is difference between ienumerable and enumerable in c#?

0 Answers  


What are assemblies?

0 Answers   Microsoft,


If we inherit a class do the private variables also get inherited ?

2 Answers   TCS,


c# code for how to merge two sorted arrays Input : A = 2,5,8,4 B = 3,9,10,5 Output : 2,3,4,5,5,8,9,10

3 Answers  


What is use of console?

0 Answers  


what is namespace?

6 Answers  


1)what is timestamp in C# (anilringole@gmail.com)

2 Answers   Wipro,


Categories