The ++ operator just can't overload. I want to know what is going on. Every time i cin a number, it only gives the origin one back to me. Thanks for your help!!
class PrimeNumber
{
public:
PrimeNumber();
PrimeNumber(int ininum1);
int getprime();
PrimeNumber& operator ++ () ;
PrimeNumber& operator -- () ;
bool isprime(int ininum1);
friend ostream& operator <<(ostream& river, const PrimeNumber& ini);
private:
int ininum;
};
Num is a class, not a number. You want to access ininum in class num. Do that with dot notation, num.ininum. So to increment and display the number you would go:
1 2 3
PrimeNumber num = PrimeNumber(26);
++num.ininum;
cout << num.ininum;
EDIT: I just noticed ininum is private so you won't be able to access it like that. You'll have to make it public or write a getter function in your class, then use dot notation to call your getter function.