Can somebody tell me how to override a function by using the scope resolution operator ( :: )?

It's automatic as far as I can remember. It's been a while since I did inheritance/poly but when a derived class has a function with the same name as the base class, the derived class's member function is said to override the base class's. Well I think so at least. I cannot guarantee that I'm right.

Anyway something like:

class A
{
    public:
        A(){}

    void Foo(int K) {}

};

class B : public A
{
    B() {}

    void Foo(int K) {}    //This should override the one in the base class "A".

    void CallBaseFoo()
    {
        A::Foo(10);       //Calls the base class' Foo instead of this class' Foo.
    }
};

EDIT!! Found something on google that "MIGHT" be what you're looking for: http://oscience.info/computing-technology/overriding-member-function-in-c/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.