- 2
Operator overloading - Am I reading peoples minds here?
Fill in the blanks to declare a class ''Sally'', with two constructors, one default constructor (without parameters), and a constructor with one integer parameter. _____ Sally { _____: Sally(); Sally(___); } This may be a stupid question, but am I guessing someone's name for the integer parameter here? If so, would someone be so kind as to give me the name so that I can continue this lesson.
7 ответов
+ 1
Class
Public
Int
Thats the answer in order
+ 1
_class____ Sally
{
_public____:
Sally();
Sally(_int__);
}
0
The "name" is int.
0
whats funny...tried that a few times and say its wrong...was the first thing I tried. Thank you for answering that stupid question lol.
0
when defining a method with argument (in .h) there is no need to name the arguments.
Just saying the type and order is enough.
And you should name it in declaration (in .cpp).
0
Drag and drop from the options below to define an overloaded + operator for the class ''Test''.
Answer:
Test Test:: operator+
(Test obj) {
Test
newObj;
newObj.mem =
mem +
obj.mem;
return newObj;
}
0
class
public
int