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 odpowiedzi
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
Saad Saleem
Saad Saleem - avatar
0
Bye the way code has many basics error
17th Apr 2020, 1:43 PM
Saad Saleem
Saad Saleem - avatar
0
Where are the mistakes?
17th Apr 2020, 2:06 PM
Sarah Alfaraj
Sarah Alfaraj - avatar