It's working fine. You just never call the function you made. Try this instead in main:
1 2 3 4 5 6 7 8 9 10 11 12 13
//in main.cpp
#include "MyClass.h" // defines MyClass
#include <iostream>
usingnamespace std;
int main()
{
cout << "Output Numbers";
MyClass foo;
foo.foo(); //Call the function foo() which is a member of MyClass
cin.get();
return 0;
}
Although MyClass.foo() will always output the same random number unless you call it more than once, or call srand() before outputting the random number.