0

Possible Duplicate:
How do you declare an interface in C++?
Interface vs Abstract Class (general OO)

I found many threads on this topic interface Vs abstract class but I didn't find the enough knowledge I am looking for.

Actually i want to see the scenario where if i use interface that is better then abstract class and vice verse.

If any one can suggest me any link where i can see some real time solution not just analogy , that will help me a lot.

(Please give your suggestion in context of C++ )

Community
  • 1
  • 1
Abhishek Gupta
  • 1,173
  • 4
  • 12
  • 26

1 Answers1

0

An interface is a contract, you can implement few interfaces for one class. As oppose to abstract class, you can extend only one. So, if you want to communicate with few programs interface would help you, like (in java) comparable and something else.

The advantage of abstract class is that you can already implement the methods that are relevant for that class. So, when you inherit that class you will already have these methods without the need to duplicate the code if you use an interface.

Hope I helped.

siditom
  • 149
  • 1
  • 8