Can I exclude a base class member from the derived class?

Question!

Let's say I have a class called CWindow:

class CWindow
{
public:
    virtual bool Create();
};

In the derived class CMyWindow, I want to overload the Create(void) method to Create(int someParam), BUT, I do not want the user to be able to call the Create(void) method, only the Create(int someParam). Is this possible? Could I do:

class CMyWindow : public CWindow
{
private:
    bool Create();
public:
    virtual bool Create(int someParam);
};

Is this valid? Will it basically make the formerly public member of CWindow be a private member of CMyWindow?

I imagine if it IS possible to 'exclude' a member from a class, that this is closest to doing so, because AFAIK there is no magic youcantbeamember keyword in C++

My best guess is that no, you cannot do this. But I'm just hoping because I would like to avoid making a base class that has everything except for the Create() member, and deriving CWindow and CMyWindow from CWindowBase.



This video can help you solving your question :)
By: admin