+ 1

What is this code's problem?

The error is no matching function for call to clocktype::add(int, int) I don't know what's the problem https://code.sololearn.com/cfhZDVfn9kA0/?ref=app

25th Jan 2022, 1:37 PM
Nadia
Nadia - avatar
2 Réponses
+ 1
Your class do not have a definition for add() function which accepts two integers. You tried to call a non existing add() function passing two integers at line 205 myclock.add(3,30); There is only one definition of add() function that accepts a `clockType` reference, declared at line 20 void add(clockType&) const;
25th Jan 2022, 2:01 PM
Ipang
0
Your add function's argument is of clocktype class and it has only single argument so you can pass either myclock or yourclock objects as argument to add function so use either myclock.add(myclock); or myclock.add(yourclock); I don't know is it results as you expecting or not.. but that's the way to remove error. hope it helps..
25th Jan 2022, 2:03 PM
Jayakrishna 🇮🇳