Skip to content

Comment on Defective C++parent

Comments

The natural way to define a member variable is (...)

No, that's not right at all. Your example is only a declaration of an incomplete type. You cannot do anything with it except.... Define a pointer to the incomplete type, and use that to keep the type definition hidden.

That technique is called pointer to implementation - pimpl. The thing you're complaining about?

OK, set me right. How do you declare a member variable "m" of type "Complextype" in C++?

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.