3 ms·
> classes have the features of structs (and much more) at the cost of performance. Not true; C++ classes have zero performance overhead over C/C++ structs (bec
by smitherfield 9y ago
> classes have the features of structs (and much more) at the cost of performance.
Not true; C++ classes have zero performance overhead over C/C++ structs (because they're just another word for the same thing).
Of course Python classes have a lot of costly features that C++ classes don't have, but the notion of a "class" (with methods, constructors etc) is not one of them.
- kronos29296 9y agoAnd also makes them look more complicated with more syntax. C++ has all those features that I will never know without adding performance. But people don't use Python for performance but ease of use. In C++ ease of use is given up for the sake of performance. In python it is the other way.
- hasenj 9y agoDon't C++ classes (and therefore structs) have a hidden vtable?