thisfunction = thatfunction (?) [Archive] - C Board

PDA

View Full Version : thisfunction = thatfunction (?)


Skarr
08-06-2002, 06:05 AM
I have this problem:

I have a class (let us call it A). A contains a function called doit(). Every time I need to make doit() different, I have to make a subclass, and change it virtually. Is there a smarter way around this?

SilentStrike
08-06-2002, 06:35 PM
That is certainly one way of doing it. If you don't care to be able to use functions that "doit", the subclassing solution is ok. If you want to be able to use functions as well as classes, you might want to check this thread, about functors.

http://www.cprogramming.com/cboard/showthread.php?s=&threadid=13855&highlight=template

Replace the check member function with doit, and I think you have the same problem as the person from that post.