Inheriting from a class that is inherited from CGenericDeviceBase

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Inheriting from a class that is inherited from CGenericDeviceBase

nanthony
Sorry if this is too much of C++ question, I haven't been able to find any
similar examples online though.

I have a device adapter which inherits from the CGenericDeviceBase like so:

/class MyClass: public CGenericDevice<MyClass> /

I then have another class that I would like to be derived from MyClass.
However if I do something like:

/class OtherClass: public Myclass/

Then when I go try to initialize properties in OtherClass::Initialize I get
errors saying:

/error C2664: 'MM::Action<T>::Action(T *,int (__cdecl MyClass::*
)(MM::PropertyBase *,MM::ActionType))' : cannot convert parameter 2 from
'int (__cdecl OtherClass::* )(MM::PropertyBase *,MM::ActionType)' to 'int
(__cdecl MyClass::* )(MM::PropertyBase *,MM::ActionType)'
/

I have tried many things including having OtherClass declared as:

/class OtherClass: public MyClass, public CGenericDeviceBase<OtherClass>/

As well as by trying to turn MyClass into a template:
/
template<class U>
class MyClass: public CGenericDeviceBase<U>/

But everything I have tried has just resulted in more confusing errors. Is
there a proper way to do this?



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Inheriting from a class that is inherited from CGenericDeviceBase

nanthony
Nevermind, I got it worked out. Defining `MyClass` as a template was the way
to go, just had to make sure it was all implemented in a header file.



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general