C++ OOP: output issue
I have one header file and a source file. I have declared my variables in header file and I am trying to implement them in my source file. I am trying to add the to values of variable a and b but the output is 0 for some reason. Any idea as why is 0 the output even though I am trying to return a + b. my header file (sum.h) code is below: class sum { private: int a; int b; public: int add_numbers(); int setValues(int a, int b); }; my source file is code is below ( .cpp) #include <iostream> #include "sum.h" using namespace std; int sum::add_numbers() { return a + b; } int setValues( int a = 6, int b = 8); int main() { sum test; cout << test.add_numbers()<<endl; return 0; }