Can we inherit an interface in an abstract class?
Answer Posted / sowmya
no we can't
using System;
interface abs
{
void display();
}
abstract class abs1:abs
{
public abstract void read();
}
class ba:abs1
{
int a;
public override void read()
{
Console.WriteLine("enter any value");
a=Convert.ToInt32(Console.ReadLine());
}
public void display()
{
Console.WriteLine(" Ur entered value:{0}",a);
}
}
class main
{
public static void Main()
{
ba b=new ba();
b.read();
b.display();
}
}
error CS0535: 'abs1' does not implement interface member
'abs.display()'
| Is This Answer Correct ? | 1 Yes | 6 No |
Post New Answer View All Answers
How will you allow a class to be inherited, but prevent the method from being over-ridden?
What is an event in c#?
Explain the types of comments in c#?
Can we have multiple constructors in a class c#?
What do you mean by jagged array?
what is generics? can u explain 5 to 6 examples on generics that covers class,method,structure,list,delegates?
What is the difference between interface and inheritance in c#?
What is an int in c#?
Can class be protected in c#?
What is Implementation inheritance and interface inheritance?
Can namespace contain the private class?
How can it prevents DLL Hell assembly versioning in .NET?
How long does it take to learn c# for unity?
What is a helper method in c#?
What are predicates in c#?