Hi all,

I have two classes C and D these classes are inherited from B class. My question is how can I use a member function of C at D and at D's child classes? I tried to do it with a regular function but it does not work in class definitions. I also tried friends and it does not work. If you can provide your reply with an example I will be grateful.
I appreciate for helps,

Thanks,

Recommended Answers

All 2 Replies

>> My question is how can I use a member function of C at D and at D's child classes?
I don't understand that sentence. Can you elaborate or show what you mean with a simple example that shows what you want to do even if it doesn't work?

I have doctor class and patient class, these two of them are inherited from person class. The doctor class has a member function "double get_fee_of_doc() const;" it returns a double value. I want to use this double value in a member function of patient class to make a very simple calculation. So my question is how can I call or use the value returned from double get_fee_of_doc() const;? If this information is not enough please let me know to post a portion of codes.
Thanks a lot,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.