2 ms·
If this is true, there is nothing that forces you to write classes in C++. You have all the freedom to write only in functions and structs. Except that abstrac
by qb45 13y ago
If this is true, there is nothing that forces you to write classes in C++. You have all the freedom to write only in functions and structs.
Except that abstract classes are pretty much the only way to implement type-checked interfaces and they are, well, classes.
- cbsmith 13y agoNot at all. You can use CRTP, you can use structs, you can use SFINAE, etc. UPDATE: And for the record, inherence of pure interface classes works just fine in C++. The stuff where it gets ugly is when you try building a deep inheritance hierarchy of behaviour. It can work, but usually not terribly well.