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
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 |
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 |
What happens if a static constructor throws an exception?
I want to print "Hello" even before main() is executed. How will you achieve that?
What is private and shared assembly?
What is the use of convert toint32 in c#?
How can i load the text box and label at the runtime based on the existing text box and tabel
2 Answers Merrill Lynch, Patni,
How does foreach loop work in c#?
What is the usage of Enumeration in C# Programming and is it good to use or not ?
Can an abstract class have a constructor c#?
What are the problem with .NET generics?
What are the various components in crystal reports?
What is the use of nullable types in c#?
How to implement delegates in c#.net