pure virtual functions and /clr

P

Peteroid

I'm trying to create an abstract base class with a pure virtual method
(using /clr and VS C++.NET 2005 Express). This will do the trick:

ref class baseClass
{
protected:
virtual void VMethod( ) abstract ; // i've tried '= 0' syntax too, no
luck
} ;

But, whenI try to create a child class, I can't figure out how to define the
virtual method to satisfy the compiler. That is, this doesn't work:

ref derivedClass : public baseClass
{
protected:
virtual void VMethod( ) {} // error
} ;

How do I do this correctly?

[==P==]
 
P

Peteroid

I think I got it:

ref class derivedClass : public baseClass
{
protected:
virtual void VMethod( ) override {}
} ;

[==P==]
 
C

Carl Daniel [VC++ MVP]

Peteroid said:
I think I got it:

ref class derivedClass : public baseClass
{
protected:
virtual void VMethod( ) override {}
} ;

You got it.

-cd
 

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