This is a sample code explaining the question.
Why does the "display()" not call the member function rather it calls the non member function ?
    #include<iostream>
    using namespace std;
    class foo
    {
        private:
            int num;
        public:
            // Constructor
            foo() : num(0){}
            // Member function
            void display()
            {
                cout<<"This function is inside class foo"<<endl;
            }
    };
    // Non-member function
    void display()
    {
        cout<<"Non-member function called."<<endl;
    }
    int main()
    {
        foo obj;
        obj.display();      
        display();          // Why does this not call the class member function, 
                            // even though it is public ?
        return 0;
    }
Kinda new with the language.
 
    