How to create interfaces in C++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to create interfaces in C++?

If anyone could give me an example of creating interfaces in C++, something similar to C# or Java. I could google it, but prefer something from this platform. Thanks

15th Aug 2020, 6:58 PM
Lucas
1 Answer
0
C++ has no built-in concepts of interfaces. You could implement it with abstract classes which contain only pure virtual functions. Due to it allowing multiple inheritance, you can inherit this class so that you can create another class which will contain this interface(I mean object interface) in it. Here is an example:- https://hastebin.com/evelofoqub.cpp
24th Aug 2020, 6:58 AM
Maheer Asghar
Maheer Asghar - avatar