Operator overloading - Am I reading peoples minds here? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 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.

3rd Oct 2016, 3:06 PM
James Watt
7 Answers
+ 1
Class Public Int Thats the answer in order
23rd Nov 2020, 4:58 AM
Liowellyn Asoganyi
Liowellyn Asoganyi - avatar
+ 1
_class____ Sally { _public____: Sally(); Sally(_int__); }
13th Dec 2020, 1:49 PM
Bhawya Daga
Bhawya Daga - avatar
The "name" is int.
3rd Oct 2016, 3:15 PM
Zen - avatar
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.
3rd Oct 2016, 4:12 PM
James Watt
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).
24th Oct 2016, 2:07 AM
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; }
18th Sep 2020, 9:08 PM
class public int
9th Feb 2022, 9:22 AM
michael mitiku
michael mitiku - avatar