C++ Interface

Is it possible to create an interface in C++? If Yes, how?

Questions by kliton

Showing Answers 1 - 6 of 6 Answers

Mohit

  • Jul 31st, 2014
 

Yes you can do it by making a function with help of virtual keyword

Code
  1. class StockPrice

  2. {

  3.    virtual void CalculateStockPrice() = 0;

  4. }

  Was this answer useful?  Yes

Zeeshan Mohammad

  • Dec 11th, 2014
 

I would prefer to write a structure and declare a function there for interface.

Code
  1.  

  2. typedef struct _ITestInterface

  3. {

  4.         virtual void testFunc() =0;

  5. }ITestInterface;

  6.  

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions