-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible fixes to FunctionPointer PR (#28) #30
Comments
Can you assign an uninitialised object instead of If the destructor needs to be virtual, then it should be public, I think? |
Yup, that's why I thought that composition might be the better option here. After all, if both your constructor and destructor are protected, you're not expecting to ever cast your reference to the base class (which is the intended behaviour here), so that's not really an |
Actually, how would virtual inheritance even work here. Won't we always pass these objects around by value? |
It would technically work, except you're not even supposed to use the base class directly. Yet another reason to think that inheritance is the wrong mechanism. That was actually protected inheritance initially, which is a bit better, but I still think composition is preferable to that. |
Composition should be okay. |
#28 introduced a number of questionable changes:
clear
method inFunctionPointerBase
andFunctionPointerBind
. This was introduced because it looks like it might be needed in MINAR. If it turns out that it's not,clear
needs to be removed.FunctionPointerBase
(following the already present private constructor). With that in mind, It might be thatFunctionPointerBind
andFunctionPointerX
should not inherit fromFunctionPointerBase
, but rather include it, using composition (and a proper name change). This isn't an error, just a possible improvement if it turns out to be the right idea.The text was updated successfully, but these errors were encountered: