Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Can we inherit an interface in an abstract class?

Answers were Sorted based on User's Feedback



Can we inherit an interface in an abstract class?..

Answer / sanjeev chaubey

Yes. you can

Is This Answer Correct ?    21 Yes 1 No

Can we inherit an interface in an abstract class?..

Answer / arne

yes you can. The example from anwser #4 is incorrect.

using System;

public interface IDisplay
{
void Display();
}

public abstract class MyClass : IDisplay
{

public MyClas(){};

public abstract DoSomething();

public void Display() {};
}

This code compiles fine without a problem. Abstract classes can inherit from interfaces as an abstract class defines the the functionality and restrictions for subclasses.

Is This Answer Correct ?    6 Yes 0 No

Can we inherit an interface in an abstract class?..

Answer / suyog

Yes ,We can

Is This Answer Correct ?    6 Yes 3 No

Can we inherit an interface in an abstract class?..

Answer / manish gobade

in order to run the above code we must impliment display() method of interface abs into class ba.

Is This Answer Correct ?    4 Yes 2 No

Can we inherit an interface in an abstract class?..

Answer / uma

no

Is This Answer Correct ?    5 Yes 6 No

Can we inherit an interface in an abstract class?..

Answer / 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

More C Sharp Interview Questions

What does == mean in c sharp?

0 Answers  


Explain About disco and uddi

0 Answers   Digital GlobalSoft,


What is parallel foreach in c#?

0 Answers  


How would you describe encapsulation in c#?

0 Answers  


What is difference between new and override in c#?

0 Answers  


What is the use of base keyword? Tell me a practical example for base keyword’s usage?

0 Answers  


What is the meaning of 0 in c#?

0 Answers  


What is the benefit of delegate in c#?

0 Answers  


Is string reference type / value type ?

7 Answers   3i Infotech, Accenture, BirlaSoft,


Why do we override in c#?

0 Answers  


What is the difference between Decorator and Adapter pattern?

0 Answers   QuestPond,


Can we have the method in drived class with the same name which is there in base class?

6 Answers   TCS,


Categories