I
I
Ihaarr2021-05-05 22:32:42
OOP
Ihaarr, 2021-05-05 22:32:42

How to implement interfaces in C++?

Are interfaces in C++ a class where only pure virtual functions?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Bannikov, 2021-05-05
@Ihaarr

Yes. An interface in C++ is an abstract class that contains only abstract methods.

V
vanyamba-electronics, 2021-05-05
@vanyamba-electronics

class Interface
{
virtual void add_ref() = 0;
virtual void release() = 0;
virtual void get_interface(IID iid, void** pInterface) = 0;
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question