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

How can we make a thread sleep for infinite period ?

0 Answers  


Explain constructor?

6 Answers   Wipro,


WHICH IS THE BEST BOOK FOR A BEGINNER TO LEARN AP.NET 3.5, C#.NET & ALL THE FEATURES OF VISUAL STUDIO2008? WHAT ARE THE CERTIFICATIONS IN THIS FIELD? WHICH IS BEST BOOK FOR CLAERING CERTIFICATION EXAM? PLZ HELP ME YAAR

1 Answers  


Why do we use reflection in c#?

0 Answers  


Is int reference type c#?

0 Answers  






What is cshtml extension?

0 Answers  


what are the different ways to cleaning up objects?

2 Answers   Wipro,


What is bit in c#?

0 Answers  


How to override a function in c#?

0 Answers  


Can main method be final?

0 Answers  


How does foreach loop work in c#?

0 Answers  


What is the adv of using System.Text.StringBuilder over System.String?

0 Answers   Siebel,


Categories