B
Bora
I usually find that a number of unrelated classes require the same kind of
operations. However, I don't want to duplicate code in multiple places. In
Java, I've seen those "Utility Classes", which are basically static
(singleton) classes created to encapsulate related operations in one class.
These methods can be called from other classes that need same functionaliy.
Is there a similar concept in C++?
I know that if two classes require the same operations, it might be
reasonable to derive them from a base class and move those operations to the
base class. However, in my case, I really considered this and found that my
classes represent really different concepts, albeit requiring a number of
similar operations. So, creating a utility class seemed reasonable.
I'd like to here your suggestions about this.
Thanks,
Bora
operations. However, I don't want to duplicate code in multiple places. In
Java, I've seen those "Utility Classes", which are basically static
(singleton) classes created to encapsulate related operations in one class.
These methods can be called from other classes that need same functionaliy.
Is there a similar concept in C++?
I know that if two classes require the same operations, it might be
reasonable to derive them from a base class and move those operations to the
base class. However, in my case, I really considered this and found that my
classes represent really different concepts, albeit requiring a number of
similar operations. So, creating a utility class seemed reasonable.
I'd like to here your suggestions about this.
Thanks,
Bora