Re: Defining shared class member functions only once
You have the right to have your own opinion, as do I to have mine. Nobody wins or loses here.
Re: Defining shared class member functions only once
I know. Notice the smiley in the last post :)
I just wanted to acknowledge your superiority in the matter. After all, I'm just an electronics guy that does some embedded and PC software programming too. :)
Notice the smiley again :)
Happy new year by the way !
Re: Defining shared class member functions only once
Quote:
Originally Posted by
wysota
An alternative is to have an external helper class that implements solely the "shared" functionality and call that object's methods passing the object it is to manipulate. Then you need implementations of that class to handle objects of specific types (ones that have the "RGB" functionality and those of the "TIME" functionality). Patterns like 'visitor' or 'strategy' come to my mind here but probably more solutions are possible and viable.
In the end you have one "instance" of functionality per class instead of having one per item which escapes the memory hog trap.
I'm intrigued by this possibility. Are you basically describing the situation of having specialized storage classes with one generalized access class?
Re: Defining shared class member functions only once
More like having specialized functionality classes with one generalized structure/access class.