Why Compiler error ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
10th Nov 2019, 11:18 AM
Rama Rehawi
Rama Rehawi - avatar
2 Answers
+ 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