
Originally Posted by
mickey
why I shouldn't use pointertomembers.
They're ugly, so if you want ot use them, hide them inside the class.

Originally Posted by
mickey
Anyway: What do you suggest for this case? The same?
How about this?
TransformationFactory::TransformationFactory()
{
transformations[ SomeTransformation ] = new SomeTransformation();
...
}
const Transformation * TransformationFactory::get( TransformationType type )
{
return transformations[ type ];
}
...
transformedVector = factory.get( SomeTransformation )->transform( originalVector );
TransformationFactory::TransformationFactory()
{
transformations[ SomeTransformation ] = new SomeTransformation();
...
}
const Transformation * TransformationFactory::get( TransformationType type )
{
return transformations[ type ];
}
...
transformedVector = factory.get( SomeTransformation )->transform( originalVector );
To copy to clipboard, switch view to plain text mode
Bookmarks