Why Compiler error ? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
10th Nov 2019, 11:18 AM
Rama Rehawi
Rama Rehawi - avatar
2 Antworten
+ 5
Because `print` function is not a member of `class A`. Nonmember functions are defined in global namespace , outside scope of class. You can access them by using scope resolution (::) You can modify line 15 as ::print(s); //using scope resolution operator to access function from global namespace Everything will work fine :)
10th Nov 2019, 11:43 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 6
🇮🇳Omkar🕉 //Busy , Exams. Thank you for your answer 🙆🏻‍♀️
10th Nov 2019, 12:26 PM
Rama Rehawi
Rama Rehawi - avatar