logoalt Hacker News

pjmlp • today at 5:39 PM • 2 replies • view on HN

Nope, because you also want C types, that now are C++ types by virtue of using a C++ compiler, to also share similar behaviours.

Which is why the only difference between a struct and a class, is the default access method.

Thus that C file could be made extensible in C++, with zero code changes on the call sites.


Replies

pwdisswordfishq • today at 6:10 PM

What does this have to do with anything?

ninkendo • today at 6:17 PM

They could have just as easily said "C semantics are used when we know we're parsing C code" and declared that C++ code doesn't have implicit constructors. No, the decision to have constructors was made because it's what they wanted to do when the language was designed. You can't lean on "but C" as an excuse when those problems are so easily solved other ways.