Why is not working | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is not working

#include <iostream> using namespace std; class person : { Protected : int id ; int name; int age; public: void store(); void display(); }; class football_player : { Protected: Int Salary; Int Numberofmatches; public: void store(); void display(); int salary (Numberofmatches) { Salary = Numberofmatches * 2 +100 } }; Class basketball_player: { Protected: Int Numberofcores; public: void store(); void display(); }; int main() { person obj1; obj.id; obj.name; obj.age; return 0; }

17th Apr 2020, 1:31 PM
Sarah Alfaraj
Sarah Alfaraj - avatar
3 Answers
0
you created the object obj1 Not obj So to access class members Use obj1.id; Net obj.id
17th Apr 2020, 1:42 PM
Mr Robot
Mr Robot - avatar
0
Bye the way code has many basics error
17th Apr 2020, 1:43 PM
Mr Robot
Mr Robot - avatar
0
Where are the mistakes?
17th Apr 2020, 2:06 PM
Sarah Alfaraj
Sarah Alfaraj - avatar