Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

i cant figure out whats the error in this program, help would be greatly appreciated. cheers.xx

0 votes
asked Feb 16, 2019 by anonymous
#include<iostream>

#include<string>

using namespace std;

class person

{ public:

 string name;

  int age;

  void setName (string name);

  void setAge (int age);

  };

  class student:public person

  { public:

  int id;

  void setId (int id);

  void introduce()

  {

  cout<<"Hi my name is"<<name<<"and my age is"<<age<<"and my id is"<<id;}

 };

 int main()

student person ;

string.setName("Omar");

int.setAge("20");

omar.setId("54321");

omar.introduce();

 return 0;

}

1 Answer

0 votes
answered Feb 28, 2019 by Noah DeBord (310 points)
In the last part you forgot to add this: { you are also putting semi colons on the parenthesis when you can't.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...