#5970 Author: S. Suresh Member Level: Gold Member Rank: 0 Date: 08/Nov/2004 Rating:  Points: 2 | Abstract classes can have partial implementation in the methods whereas Interfaces cannot have implementation in them. Thanks, S Suresh
| #6001 Author: Balamurali Balaji Member Level: Gold Member Rank: 0 Date: 09/Nov/2004 Rating:  Points: 2 | Hi,
Abstract class is of a class type. Interface is of an interface type.
Abstract class can be derived by many sub classes, in hierarchial form Interfaces need to be imlemented, also by various classes, but not to be hierarchial
| #6024 Author: Nidhi Bhargava Member Level: Bronze Member Rank: 0 Date: 09/Nov/2004 Rating:  Points: 2 | Interfaces are, like classes that have definition of methods, properties, events, indexers but no implementation. Interfaces are implemented inside classes or structs.
Abstract classes are intended to be used base class. An abstract class cannot be instantiated. A non-abstract class derived from an abstract class must include actual implementations of all inherited abstract methods and accessors. Abstract and sealed (class cannot be inherited) modifier can't work together.
An abstract class can have abstract members as well non-abstract members. But in an interface all the members are implicitly abstract and all the members of the interface must override to its derived class.
Abstract classes can have protected members, static members. The members of the interface are public with no implementation An interface can inherit from one or more base interfaces. A class can inherit one or more interfaces, but only one abstract class.
| #6049 Author: Vasu Member Level: Gold Member Rank: 0 Date: 09/Nov/2004 Rating:  Points: 2 | Hi
Abstract: Abstract Classe it the we can Declare the functions and Implement the Functions.We can't the Instantiate the abstract class.We have to override the abstract classes in derived classes.we can give any type of accessaries ex puplic,private.
Interface: it is only Declarations.We can't implement here.we have only public class.we can give multiple inheritence here.
both are reference types
| #51426 Author: Abhishek Saxena Member Level: Silver Member Rank: 0 Date: 05/May/2006 Rating:  Points: 2 | Interface : Interface are special type of classes in which we can only give the declarations of Methods,Properties ,Indexers and events. It is a contract for the class implementing the interface to give the definations for all the Methods and Properties. Access modifiers are not allowed. By deafult everything is Public. Multiple Inheritance can be achieved through it.
Abstract Class: In abstract class atleast one method is Abstract. i.e without a defination. Other metods can be concrete. Access modifiers are allowed in case of Abstract Class. Also we can only achieve single Inheritance and multilevel Inheritance.
| #278640 Author: asdf Member Level: Silver Member Rank: 0 Date: 08/Aug/2008 Rating:  Points: 0 | • Abstract Class Cannot be instantiated. Must be inherited and its methods should be overridden. It have some concreate methods. Access modifiers allowed.
• Interface Have definition of a method not implementation. (implement through class) Multiple inheritance possible through Interface only Only Public Access modifier only allowed. Defaultly Public No need of virtual overridden. It's used for to define a set of properties, methods and events.
| #280913 Author: RobinHood Member Level: Gold Member Rank: 0 Date: 14/Aug/2008 Rating:  Points: 6 | Abstract Class.. 1.It cannot defines all the methods 2.It has subclass. 3.Here, Subclass is useless 4.A class can be extend an abstract class
Interface.. 1.It defines all the methods 2.It must have implementations by other classes, But there will be no use of that. 3.Only an interface can extend another interface.
For More details.. http://kyapoocha.com/c-sharp-interview-questions/what%E2%80%99s-the-difference-between-an-interface-and-abstract-class-5/ http://www.dotnetuncle.com/Difference/4_abstract_class_interface.aspx http://forums.msdn.microsoft.com/en-US/csharplanguage/thread/8ad621b8-a915-4d7e-89c3-5dbbc47202fd/
Regards Sridhar R Nothing is illegal, Until You Get Caught
| #339021 Author: Bunty Member Level: Gold Member Rank: 0 Date: 20/Jan/2009 Rating:  Points: 4 | Hi,
Following are the difference between abstract and interface,
1>Abstract class having method declaration as well as method method definition whereas interface having method declaration only.
2>Abstract class are known as partial abstract class whereas interface is known as fully abstract class.
3>Abstract class features we have to inherit to the child class whereas interface features we have to implement in the child classes.
4>Abstract class support access specifiers whereas interface doesn't support access specifiers.
5>Abstract class have normal variable as well as constant variable whereas interface have only constant variables.
6>We can write constructor in abstract class whereas we can't write constructor in interface.
Regards S.S.Bajoria
Thanks & Regards
Bunty
| #349774 Author: Mrs. Meetu Choudhary Nanda Member Level: Gold Member Rank: 0 Date: 21/Feb/2009 Rating:  Points: 6 | Abstract Class:
The class which contains the common features of components of several classes, but cannot it be instantiated by itself. It represents an abstract concept for which there is no actual existing expression. For instance, "Vegetation" is an abstract class - there is no such real, real thing as generic vegetation. Instead, there are only instances of vegetation, such as mango tree and rose plant, which are types of vegetation, and share common characteristics, such as having leaves and stem in at least part of the lifecycle.
SO in software engineering, an abstract class is a class in a nominative type system which is declared by the programmer, and which has the property that it contains members which are also members of some declared subtype. In many object oriented programming languages, abstract classes are known as abstract base classes, interfaces, traits, mixins, flavors, or roles. Note that these names refer to different language constructs which are (or may be) used to implement abstract types.
We can also say that abstract class is : -- A class which is used only as an ancestor and is never instantiated.
In other word a concrete definition will say that
A type of class with pure virtual member functions and one or more methods that are declared but not implemented, that behaves as a base class but prohibits the instantiation of any members of that class. i.e. It has a complete interface but only a partial implementation It is used to take advantage of inheritance yet prohibiting the generation of objects that are not completely defined. Concrete subclasses of an abstract class are required to flesh out the implementation by overriding the abstract methods.
Thanks and Regards Miss Meetu Choudhary (Site Coordinator) Go Green Save Green
|
|