Trying to print out object contents using a class method. Keep getting "error: statement cannot resolve address of overloaded function"

Advertisements beginner here, I am working on an assignment for a course and while working on this program, I am experiencing some troubles. I cannot figure out how to print out the contents within an object I have in my main method using a different method from a class I made. Here’s my code: #include… Read More Trying to print out object contents using a class method. Keep getting "error: statement cannot resolve address of overloaded function"

error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'Oper')

Advertisements Task is to load complex number from a file. When code was written without classes, using stuctures and specified functions only it didn’t show that error. Functions (>> overlading) were completely the same. Class #ifndef WYRAZENIE_ZESPOLONE_HH #define WYRAZENIE_ZESPOLONE_HH #include "liczbaZespolona.hh" enum Oper {op_plus, op_minus, op_razy, op_dziel}; class WyrazenieZespolone { private: LiczbaZespolona lz1; LiczbaZespolona lz2;… Read More error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'Oper')

"binary 'operator+' has too many parameters

Advertisements Trying to implement operator overloading using the following code: class Number { T value; public: Number(T v); Number(); Number<T> operator+ (Number<T>&, const Number<T> &); T getValue() { return value; }; }; template <typename T> Number<T>::Number(T val):value(val) { } template <typename T> Number<T> Number<T>::operator+ (Number<T>& lhs, const Number<T> & rhs) { return lhs.value + rhs.value;… Read More "binary 'operator+' has too many parameters

Can I somehow elegantly forbid using unsingned variables in my template function?

Advertisements Consider this piece of code: template <typename T> T abs(const T& n) { if (!std::is_signed<T>::value) throw logic_error; if (n < 0) return -n; return n; } What do I want to do: I want to completely forbid the usage of my function with unsigned variables since it doesn’t make sense and probably user is… Read More Can I somehow elegantly forbid using unsingned variables in my template function?