Well. I'm almost ashamed to ask this question. But I'm stumped. I'm trying to remember OOP (haven't programmed in awhile), and I'm having some trouble.
I know it's some tiny little thing I missed, like a semi-colon or something. Just incase you haven't caught on, it's just supposed to subtract 4 and 3.Code:#include <iostream.h> class CSubtraction { int s1, s2; public: void Equalize(int,int); int Subtract(void) {return (x-y);} }; void CSubtraction::Equalize(int x, int y) { x = s1; y = s2; } int main() { CSubtraction sub; sub.Equalize(4,3); cout << "Answer: " << sub.Subtract(); return 0; }
The errors:
Line 8: 'x' undeclared
Line 8: 'y' undeclared
Thanks guys.![]()



LinkBack URL
About LinkBacks



