When a pointer to a class can be forced to convert to another class of pointers, even if there is no derived relationship betwee

xiaoxiao2021-03-06  24

A side effect for forced conversion is that protected modifiers are no longer a protective umbrella for class members. Consider the following case class a {protected;}; if I want to get M_IProtected Public Access, I can write a package class class b: public a {public: int & getProtected () {return M_IProtected;} Friend Class C ;}; Then converting the a type of pointer to B types to access the statement of m_iprotected as a public mode. Members accessed in Class C are not restricted.

Although more inheritance is a characteristic of C , from ideal, CeditView should be derived from CCTRLVIEW and CEDIT; however, all people know how troublesome in MFC. For MFC's COBJECT derived class, the default situation is not allowed - although you can pass the MFC Technical Document TN016: Using the method provided in the USING C Multiple Inheritance With MFC manually adds multi-inheritance support. In fact, these features should be provided in the form of an interface - converting getItctrl to queryInterface, but this performance will lose a lot, and Windows General Controls and MFCs are always constantly upgrading - the nightmare of the interface It is an upgrade - so the MFC uses the "hacker" method to provide and multi-inheritance. Keywords: MFC "No Data MEMBERS" Reference C Q & A - Microsoft Systems Journal May 1998

转载请注明原文地址:https://www.9cbs.com/read-65334.html

New Post(0)