Answer the question
In order to leave comments, you need to log in
Why does this function return an object (operator overloading)?
Good evening
Factory Factory::operator*(const int& a)const{
return a*this->a;
}
Factory obj1 = 1; //Первый единственный параметр для конструктора - int
Factory obj2 = 2 * obj1;
Answer the question
In order to leave comments, you need to log in
Question: in return I multiply two ints, the function returns a copy of the Factory, why is that?
int Factory::operator *
- everything would be different. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question