+ 1
Why its shows error?
What is wrong with this program? https://code.sololearn.com/c7JeQiDdnvGg/?ref=app
2 Respuestas
+ 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();
0
Thank you