what is the difference between interface and abstraction?

Answers were Sorted based on User's Feedback



what is the difference between interface and abstraction?..

Answer / ashish gupta

1) In Interface we can give only declarations not
definitions but in abstraction we can hv definitions also.
2) In an Abstraction we must hv at least one abstract
function.
3) Abstraction can not be instantiate .
4) In Interfaces we can not assign access identifier.
5) A class can implement 2 interfaces but can inherit only
one Abstract function.

Is This Answer Correct ?    27 Yes 4 No

what is the difference between interface and abstraction?..

Answer / sajid

interface:
in interface,all methods must b abstract,by default all
members are PUBLIC,cant b implimented infact derived class
impliments its methods
interface can use multiple interface
abstract:
it is just like interface,not imolimented by itself,only
derived class can impliment abstract class or abstract
methods,abstract methods can b private unlike interface,cant
allow multiple inheritance

Is This Answer Correct ?    10 Yes 2 No

what is the difference between interface and abstraction?..

Answer / navin c. pandit

In Interface, all the member functions are abstract implicitly
so it is imp. to define all fn. declared inside Interface.
Moreover, we cann't define a fn. or we cann't declare any
member variable in an Interface. Also, we cann't declare or
define any non-abstract method in Interface.

In Abstract class, we can declare an abstract method as well
as we can also define a non-abstract method. We can also
declare a variable member in abstract class.

In both the condition, declared abstract method is
implemented out side the class i.e in derived class which
inherits Interface/Abstract class, whatever you have used.

Is This Answer Correct ?    4 Yes 3 No

what is the difference between interface and abstraction?..

Answer / durgaprasad shetty

Interface produce loose coupling. Abstraction produce tight
coupling now u r question what is coupling coupling is
dependency between functions.
Abstraction methods dont have body.
Interace mainly using in multiple inheritence because
abstract will not support to multiple inheritence.

and + Ashish gupta's Answer

Is This Answer Correct ?    1 Yes 0 No

what is the difference between interface and abstraction?..

Answer / anshul jain

An interface cannot provide any code, just the signature.
An abstract class can provide complete, default code and/or just the details that have to be overridden.
An interface cannot have access modifiers for the subs, functions, properties etc everything is assumed as public
An abstract class can contain access modifiers for the subs, functions, properties

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C Sharp Interview Questions

what is main function of alternate teamplate of datalist?

0 Answers  


How does the clr work?

0 Answers  


What is arraylist?

0 Answers  


What is distribute by in hive?

0 Answers  


What are the drawbacks of extending an interface as opposed to extending a class?

0 Answers  






Why do we need dependency injection in c#?

0 Answers  


In a C# class we have a SortedList member m_addinProjects we want to provide an iterator to allow the consumer of this class access to the items in the collection. Please provide an iterator method for the AnalyzeAddinsDLL class below and an example of how it would be used. namespace AnalyzeAddinsDLL { public class AllAddInProjects { private SortedList<string, AddInProject> m_addinProjects; public AllAddInProjects() { m_addinProjects = new SortedList<string, AddInProject>(); } } }

0 Answers   ABC, WinsIndia,


What is concrete method in c#?

0 Answers  


What do multicast delegates mean?

0 Answers  


What is assembly c#?

0 Answers  


Explain the difference between a struct and a class?

0 Answers  


What are strongly typed objects?

0 Answers  


Categories