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


Please Help Members By Posting Answers For Below Questions

Okay, so an int is a value type, and a class is a reference type. How can int be derived from object?

535


What does using system mean in c#?

489


Why do we use lambda expression in c#?

496


Which is better python or c#?

451


What is the purpose of a console table?

463






Can we inherit abstract class in c#?

477


Why do we need interfaces in c#?

477


What are the concepts of dispose method?

483


What is data binding c#?

519


What is console application with example?

489


What is the use of 0 in c#?

491


What is a method c#?

466


Explain async and await?

528


Is c# lazy thread safe?

482


What are the advantages of generics in c#?

489