Hi
I get a weird compiler error when trying to access a public function in a base class, from an instance of a derived class.
Here is a part of the base class:
class CControl
{
public:
CControl()
{}
CControl(HWND _hwnd)
{
AttachWindow(_hwnd);
}
~CControl()
{
DetachWindow();
}
/* Destroy
*/
virtual BOOL Destroy()
{
DetachWindow();
return DestroyWindow(this->hwnd);
}
/* SetFocus
*/
virtual HWND SetFocus()
{
return ::SetFocus(this->hwnd);
}
.
.
.
The sub class is derived from CControl:
class CTest : CControl
{
public:
CTest();
CTest(HWND hParent, int id);
.
.
.
Now, when I create an instance of CTest and try to access SetFocus or Destroy, like this: ctest.Destroy(), I get this error:
error C2248: ''SetFocus'' : cannot access public member declared in class ''CControl''
f:\kod\c++\controls\controlshit\ccontrol.h(33) : see declaration of ''SetFocus''
It''s public, so why can''t I access it??! I''m new to OOP in C++, so don''t get too hard on me
Regards Mats