O
Olivier Scalbert
Hello,
Let's say I have a base class Event and some sub classes EventType1,
EventType2, ...
1)
I would like to have a collection (vector or list for example) of a mix
of EventType1, EventType2, ...
I think I have to create a vector<Event*> and starts playing with "new".
And of course, I will forget the "delete" !
Are there any other options, to keep the code clean ?
2)
I would like to transform (serialize in string or something else) these
events (contained into a collection). As I will have different
transformations, I do not want to put the serialization code inside the
events, to not pollute them. How can I do that, in a clean way ? Visitor
pattern or something like that?
Thanks you very much and have a nice day !
Olivier
Let's say I have a base class Event and some sub classes EventType1,
EventType2, ...
1)
I would like to have a collection (vector or list for example) of a mix
of EventType1, EventType2, ...
I think I have to create a vector<Event*> and starts playing with "new".
And of course, I will forget the "delete" !
Are there any other options, to keep the code clean ?
2)
I would like to transform (serialize in string or something else) these
events (contained into a collection). As I will have different
transformations, I do not want to put the serialization code inside the
events, to not pollute them. How can I do that, in a clean way ? Visitor
pattern or something like that?
Thanks you very much and have a nice day !
Olivier