Difference between abstract class and interface

Answer Posted / ved prakash mishra

ABSTRACT CLASS:-An abstract class declares common attributes and behaviors of the various classes in a class hierarchy. An abstract class typically contains one or more abstract methods that subclasses must override if the subclasses are to be concrete. The instance variables and concrete methods of an abstract class are subject to the normal rules of inheritance.

Attempting to instantiate an object of an abstract class is a compilation error.
Failure to implement a superclass's abstract methods in a subclass is a compilation error unless the subclass is also declared abstract.
we can use abstract superclasses to declare variables that can hold references to objects of any concrete class derived from those abstract classes. Programs typically use such variables to manipulate subclass objects polymorphically. We also can use abstract superclass names to invoke static methods declared in those abstract superclasses.

interface:- A subclass can inherit "interface" or "implementation" from a superclass. Hierarchies designed for implementation inheritance tend to have their functionality high in the hierarchyeach new subclass inherits one or more methods that were implemented in a superclass, and the subclass uses the superclass implementations. Hierarchies designed for interface inheritance tend to have their functionality lower in the hierarchya superclass specifies one or more abstract methods that must be declared for each concrete class in the hierarchy, and the individual subclasses override these methods to provide subclass-specific implementations.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the number or character entered through keyboard gets converted to equivalent ascii code & it get stored on ram in the binary form. What is the exact procedure on hardware that converts the ascii value to binary? : .NET Architecture

447


How can I create a application?

512


Can you Explain element .net mobile with example? : Microsoft dot net mobile

485


What is the mesi? : .NET Architecture

598


Difference between type constructor and instance constructor?

546






What is the use of TPL DATAFLOW?

547


Explain pipelining? : Dot net architecture

590


What is Object Caching in Visual Studio 2010?

597


Explain about appdomains?

605


can u give me real example of how web.config overrides the machine.config file?

1289


Explain the difference between l1 and l2 cache? : Dot net architecture

548


Explain the types of memory management? : Dot net architecture

498


Explain the number or character entered through keyboard gets converted to equivalent ascii code & it get stored on ram in the binary form. What is the exact procedure. : Dot net architecture

528


Explain the five stages in a dlx pipeline? : .NET Architecture

506


Explain .net mobile events? : Microsoft dot net mobile

520