Hi all,
I'm trying to refactor some code and wanted design advice.
Here's where I'm starting:
I have a class called Classifier which is based upon the singleton
pattern:
class Classifier {
public:
const Classifier& get(type t);
private:
Classifier(type t);
static map<type, Classifier> _map;
};
When you Classifier::get(t), it retrieves the corresponding Classifier
from _map, constructing it if necessary.
I want to make a subclass BuildClassifier, which has a ::get method
that retrieves a *non*-const BuildClassifier, and each BuildClassifier
object will contain some extra needed data.
My question is, if someone calls Classifier::get(t), I now want to
return the BuildClassifier object associated with t (a const-version,
naturally). How can I do that?
Joseph