program does not return the value entered
#include <iostream>
using namespace std;
class testClass
{
public:
int sum();
void print() const;
testClass();
testClass(int a, int b);
private:
int x;
int y;
};
int testClass::sum()
{
int c;
c = x + y;
return c;
}
void testClass::print() const
{
cout << "x = " << x << "y = " << y << endl;
}
testClass::testClass()
{
x = 0;
y = 0;
}
testClass::testClass(int a, int b)
{
x = a;
y = b;
}
int main()
{
int a;
int b;
testClass mytestClass;
cout << "enter a value for x: ";
cin >> a;
cout << "enter a value for y: ";
cin >> b;
mytestClass.print();
return 0;
};