Static vs member functions in c++ is there an overhead

Viewed 5468

In a C++ class is there any overhead in having static function instead of a member functions.

class CExample
{
    public: 
        int foo( int a, int b) {
            return a + b ; 
        }
        static int bar( int a, int b) {
            return a + b ; 
        } 
};

My questions are;

  • In this example is foo() or bar() more effecent?.
  • Why would I not want to make foo() in to a static function as it does not alter any member variables?
4 Answers
Related