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 serialization in .net?

0 Answers  


What is the implicit name of the parameter that gets passed into the set method/property of a class?

0 Answers   Siebel,


main concept of c sharp

3 Answers  


How many bits is int32?

0 Answers  


What is arraylist?

0 Answers  






Is string reference type / value type ?

7 Answers   3i Infotech, Accenture, BirlaSoft,


How big is an int16?

0 Answers  


What?s the difference between System.String and System.StringBuilder classes?

1 Answers  


How do you convert byte array to hexadecimal string, and vice versa?

0 Answers  


Hello! How to do this: "Create manifest utility intended for creating update content files. Application should take a set of files as input parameter and generate XML based manifest file as output one." I use C# and vs.net 2003. It's urgent! Help please, thanks. Mayana

0 Answers  


What is namespace c#?

0 Answers  


Can we write one page in c# and other in vb in one application ?

3 Answers   Keane India Ltd,


Categories