The following is how I was taught to use constructors, and it seems to work for one variable, but when I use a few it seems to act odd.
I'm not too sure what to do to fix this, but I would like some direction. Thanks in advance!
#include <iostream>
#include <string>
using namespace std;
class Numbers
{
public:
Numbers (int a, int b, int c)
{
setNum (a);
setNum (b);
setNum (c);
}
void setNum (int x, int y, int z)
{
numbers = x;
digits = y;
numerals = z;
}
int getNum ()
{
return numbers;
return digits;
return numerals;
}
int add (int x, int y, int z)
{
int answer = x + y + z;
return answer;
}
private:
int numbers;
int digits;
int numerals;
};
int main ()
{
Numbers numbersobject (12,13,14);
cout << numbersobject.getNum () << endl;
return 0;
}