>i have come up with the following code but gives error
Maybe, just maybe you might want to tell us what those errors are :icon_rolleyes:
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
Since there's no line numbers on your code, how do you expect us to know which lines those errors correspond to?
Anyway, I gave up and ran it through my compiler. The problem is that you're trying to convert a const string (returned from Person::get_name and Person::get_date) to a regular string. Why are you copying the variables in your accessor functions anyway? Just let the base class do all the dirty work.
[edit]
arrgh I see you've created multiple threads. Just do what ~s.o.s~ said.
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
>so how can i access the name and date
Something like this?
Instructor myInstructor;
// ...
myInstructor.get_name(); // this calls Person::get_name()
The point of polymorphism is that it saves you from writing identical pieces of code over and over again. So then don't.
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339