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

Is c# front end or back end?

0 Answers  


Can you use all access modifiers for all types?

0 Answers  


What is variable in c#?

0 Answers  


use of operator overloading of implicit & explicit operators?

1 Answers   TCS,


What is an icollection in c#?

0 Answers  






What is the purpose of a console table?

0 Answers  


What is raise event and what is its use?

1 Answers   Wipro,


Can private virtual methods be overridden in c#.net?

0 Answers  


how to convert String array to StringBuilder array or vice versa?

3 Answers   Wipro,


How to make sure custom class supports deterministic finalization?

1 Answers   IBM,


What is the difference between TypeOf, GetType and what are the uses of TypeOf, GetType.

2 Answers   Siemens, Syntel,


What is difference between var dynamic and object in c#?

0 Answers  


Categories