0

Challenge 1 question 3 makes no sense.

It took me HOURS to find a diff. solution to call a function using arrow syntax in the final line of code. myPtr -> foo(); Is the canned answer. It took me a while to figure out since Xcode. VS 2017. Dev c++. Not a single one accepted the line of code with error: This declaration has no storage class or type specifier Either the question is archaic as in older compilers may take the solution/the answer is incorrect. If the solution does work for you outside of the challenge please post the entire code.

29th Mar 2018, 12:23 PM
Hector de Perio
Hector de Perio - avatar
2 Respuestas
+ 6
That's not true. If you create an object via pointer the arrow operator is the way to call it's methods. It works just like in the question. I guess you do some things wrong. To be able to explain your error you should post what you tried. https://code.sololearn.com/cHFRsbHtaixw/?ref=app
29th Mar 2018, 12:31 PM
Alex
Alex - avatar
+ 3
Doh.... sololearn tends to write blocks of code and not the entire working program meaning the libraries and namespaces are usually left unwritten. That’s what I should have paid more attention to.
29th Mar 2018, 1:56 PM
Hector de Perio
Hector de Perio - avatar