+ 1

Why its shows error?

What is wrong with this program? https://code.sololearn.com/c7JeQiDdnvGg/?ref=app

16th Mar 2021, 4:42 PM
Jawahirullah
Jawahirullah - avatar
2 ответов
+ 5
1. Going by the rather verbose error message, the standard library defines its own data class, so by importing the entire standard namespace, it becomes ambiguous which "data" you are using in the "stud" class. You will have to enclose your own "data" class in a separate namespace that you can refer to, rename it, or stop using namespace std. 2. Incorrect syntax when initializing "name" in the "stud" constructor, it should be : name( n ), ... 3. When displaying the student data, you are trying to insert the return value of data::show() into the output stream, although it returns void. Correct would be: cout << "Name:" << name; g.show();
16th Mar 2021, 4:51 PM
Shadow
Shadow - avatar
0
Thank you
17th Mar 2021, 2:27 AM
Jawahirullah
Jawahirullah - avatar