Hello,
does anyone know how to unwrap an Object? for example z and y are of type Element and 5 is a primitive double. I can write an operator+ function to add the two object together ie (z+y) but I don't knw what to do to add 5+z, Z is immutable and can therefore not be typecasted to be of another type. Please help. Everything I have tried failed. The code I wrote to perform addition between 2 objects can be seen below.
Element& Element::operator+(const Element &obj) const
{
Element *r = new Element(number + obj.number); /*number is an instance variable of type double in my Element Class*/
return *r;
}