I have three classes:
class ShapeEditor {}
class PointEditor: ShapeEditor{}
class RectEditor: ShapeEditor{}
I want to define a function pointer in Manager
class and pass it in constructor as lambda function. It looks like this:
class Manager {
public:
ShapeEditor (*factory)();
Manager(ShapeEditor (*_factory)());
}
Then I'm writing in main:
Manager m = Manager([] { return PointEditor(); }
and getting an error message that there is no constructor for this expression.
When I changes ShapeEditor
to PointEditor
in Manager
- it works fine, but I need to specify different types in function result.