.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal

Home >> Interview Question >> .NET Framework >> Post New Question Subscribe to Interview Questions

When do you have to declare a class as abstract?

Posted By :Amit Mehra     Posted Date :October 15, 2009    Points :10   Category :.NET Framework 
1. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden.
2. When at least one of the methods in the class is abstract.

You can also find related Interview Question to When do you have to declare a class as abstract?  below: 

What is the difference between interface and abstract class ?

a class may inherit several interfaces, a class may inherit only one abstract class (More...)

What is difference between abstract class and an interface?

An Abstract class is a class with some common/certain implementations and defines abstraction for other services which are implemented in its concrete sub classes, whereas interface only have method declaration with zero implementations. An abstract class and Interface both have method only but not have body of method. The difference between Abstract class and An Interface is that if u call Abstract class then u have to call all method of that particular Abstract class but if u call an Interface then it is not necessary that u call all method of that particular interface. An abstract class is a special kind of class that cannot be instantiated. So the question is why we need a class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses. In simple words, it is a kind of contract that forces all the subclasses to carry on the same hierarchies or standards.

An interface is not a class. It is an entity that is defined by the word Interface. An interface has no implementation; it only has the signature or in other words, just the definition of the methods without the body. As one of the similarities to Abstract class, it is a contract that is used to define hierarchies for all subclasses or it defines specific set of methods and their arguments. The main difference between them is that a class can implement more than one interface but can only inherit from one abstract class. Since C# doesn't support multiple inheritance, interfaces are used to implement multiple inheritance.

Shashi Ray (More...)

To define abstract class in VB which keyword is used?

MustInherit keyword is used to create an abstract class in VB. (More...)

Explain About Abstract Class?


An abstract class means that the class is intended to be used as a base class.
Note the following features of abstract classes:
.An abstract class cannot be instantiated.
.An abstract class may contain abstract methods and properties.
.A non-abstract class that derives from an abstract class must implement all inherited abstract methods and properties. (if any).
.An abstract class must provide implementation for all interface members

Name the classes that derive from the abstract System.Windows.Shapes.Shape class in WPF?

1) Rectangle
2) Ellipse
3) Line
4) Polyline
5) Polygon
6) Path (More...)

What's the difference between an interface and abstract class?

In an interface class, all methods must be abstract. In an abstract class some methods can be concrete. In an interface class, no accessibility modifiers are allowed, which is ok in an abstract class. (More...)

Can we implement Multiple Inheritance by using Abstract Class?

As the abstarct class can contain simple methods also, therefore it doesn't support Multiple Inheritance in DotNet. (More...)

Can an abstract class have non-abstract methods?

Yes an abstract class have non-abstract methods (More...)

What's the difference between an interface and abstract class?

Abstract Class:

A class that cannot be instantiated. An abstract class is a class that must be inherited and have the methods overridden. An abstract class is essentially a blueprint for a class without any implementation.


Interfaces like classes define a set of properties methods and events. But unlike classes interfaces do not provide implementation. They are implemented by classes and defined as separate entities from classes (More...)

What is the difference between abstract class and interfaces?

1) Concrete methods are applicable to abstract class only, interface cannot use them.

2)Abstract class uses inheritance while interface does not use inheritance. (More...)

Difference between Interface and abstract class

When we need the subclasses to must implement all the methods of base class the then we Interface.
Abstract class can also contain no-abstract methods (More...)

What's an Abstract class?

A class that cannot be instantiated.A concept in C++ known as pure virtual method.A class that must be inherited and have the methods over-ridden.Essentially it's a blueprint for a class without any implementation. (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend