Event Inheritance w/ c++ CLI not working

B

Bart

Hello Everyone,
I've just converted my code from the old managed c++ to the new c++ CLI
syntax. Some of my inherited event code is no longer compiling.
Here's part of my code...

c#

public delegate void VEPointPickedEventHandler( float x, float y, float
z );

public abstract class EventBridge
{
public abstract event VEPointPickedEventHandler PointPickedInVE;
...
}

c++ header file

public ref class VEEventBridge : public EventBridge
{
public:
virtual event VEPointPickedEventHandler ^ PointPickedInVE;

}

Here's the compiler error...
C4485: 'VEEventBridge::pointPickedInVE::add' : matches base ref class
method 'EventBridge::pointPickedInVE::add', but is not marked 'new' or
'override'; 'new' (and 'virtual') is assumed

This used to work (^ PointPickedInVE used to be *) but now it doesn't
compile. Any ideas?

Thanks
 
B

Bart

Found the problem. Here's the c++ header code that works...

virtual event VEPointPickedEventHandler ^ PointPickedInVE
{
void add( VEPointPickedEventHandler ^ value ) override {
PointPickedInVE += value; }
void remove( VEPointPickedEventHandler ^ value ) override {
PointPickedInVE -= value; }
}

hmmm, that makes sense. NOT!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top