Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / November 2005

Tip: Looking for answers? Try searching our database.

pure virtual functions and /clr

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peteroid - 13 Nov 2005 13:19 GMT
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==]
Peteroid - 13 Nov 2005 14:01 GMT
I think I got it:

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

[==P==]

> 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:
[quoted text clipped - 18 lines]
>
> [==P==]
Carl Daniel [VC++ MVP] - 13 Nov 2005 15:39 GMT
> I think I got it:
>
[quoted text clipped - 3 lines]
>   virtual void VMethod( ) override {}
> } ;

You got it.

-cd

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.