Operator overloading - Am I reading peoples minds here? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
- 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 Antworten
+ 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
0
The "name" is int.
3rd Oct 2016, 3:15 PM
Zen
Zen - avatar
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.
3rd Oct 2016, 4:12 PM
James Watt
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).
24th Oct 2016, 2:07 AM
TwinChrist
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; }
18th Sep 2020, 9:08 PM
OjeifoIduma
0
class public int
9th Feb 2022, 9:22 AM
michael mitiku
michael mitiku - avatar