Question:
How different are interface and abstract class in .Net?
Answer:
when a class is not provided with full functionalitythen it is declared as abstract.it doesn't support instance creation as well as it cannot be overridable to child class.interface is a colection of methods only without functionality.interface is 90% same as abstract class. Source: CoolInterview.com
An interface class is a class contains all functions that are are abstract.
An abstract class is a class that may or may not contain an abstract function.
Abstract function : functions with only declaration , no definition is present. the user implimenting, inheriting the function has to override the function , mandatorily.
Instances of abstract class and interface class are made at runtime.so objects cannot be created ,due to lack of informations of the class. Source: CoolInterview.com
Answered by: imran | Date:
| Contact imran
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|