I mount a function (parameter - numeric vector; returns a string). However, this same function is used in several classes. To avoid that I keep duplicating the same code within these classes there is a way to do that as the code below?
Thanks, Resident for the reply. But the use superclass don't make sense for my code. Indeed, the functions member1() and member() are very different. In fact, the class A and B are very different too. I just avoid duplicate my code.
> this same function is used in several classes.
> I keep duplicating the same code within these classes
If there is just one implementation of the function, just write it as a non-member function.
Declare it (typically in a header) and call it from anywhere you please.