4 ms·
But you still use the OOP concept of inheritance, which is basically "indirect methods with function pointers". Beside, "interfaces" don't even exist as a synta
by jcelerier 8y ago
But you still use the OOP concept of inheritance, which is basically "indirect methods with function pointers". Beside, "interfaces" don't even exist as a syntaxic concept in many OOP languages, C++ being the most prominent one.
- spdionis 8y agoI think C++ is the only one that doesn't have interfaces.
- maxxxxx 8y agoAn abstract class with only abstract methods is essentially the same.
- jcelerier 8y agoIt's most certainly not: - you have to at least implement the destructor if you are going to use the abstract class across multiple DLLs - else, dynamic_cast won't work since each DLL may have its own type_info object for the abstract class - even if a method is marked abstract, it can still have a default implementation: https://gcc.godbolt.org/z/bAE7v6 https://gcc.godbolt.org/z/bAE7v6 though other prominent OO languages are slowly catching up with this ;)
- munchbunny 8y agoThat's splitting hairs. Regardless of the syntax mechanism used to achieve it, inheritance of interfaces and inheritance of implementation are qualitatively different, in the sense that you can usually tell the difference regardless of language. Also, C++ has abstract classes with only pure virtual functions, which accomplish the same thing.