473,387 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

pure virtual functions and /clr

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==]
Nov 17 '05 #1
2 1280
I think I got it:

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

[==P==]

"Peteroid" <pe************@msn.com> wrote in message
news:uf**************@TK2MSFTNGP15.phx.gbl...
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==]

Nov 17 '05 #2
Peteroid wrote:
I think I got it:

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


You got it.

-cd
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: A | last post by:
Hi, 1) Whats the difference from a virtual function and a pure virtual function? 2) When would you use one over the over? 3) What's the significance of the word virtual? Regards,
11
by: santosh | last post by:
Hello, I was going through the Marshal Cline's C++ FAQ-Lite. I have a doubt regarding section 33.10. Here he is declaring a pure virtual destructor in the base class. And again defining...
37
by: WittyGuy | last post by:
Hi, I wonder the necessity of constructor and destructor in a Abstract Class? Is it really needed? ? Wg http://www.gotw.ca/resources/clcm.htm for info about ]
17
by: Riaan | last post by:
Hi Everybody, I created an abstract class containing all my pure virtual functions. I derived a new class from this and implemented all the functions needed. Every time I compile, I get the...
21
by: sks | last post by:
Hi , could anyone explain me why definition to a pure virtual function is allowed ?
10
by: John Goche | last post by:
Hello, page 202 of Symbian OS Explained by Jo Stichbury states "All virtual functions, public, protected or private, should be exported" then page 203 states "In the rare cases where a...
7
by: sam_cit | last post by:
Hi Everyone, I wanted to know as to what is the exact difference between a virtual function and a pure virtual function? Thanks in advance!!!
6
by: Miguel Guedes | last post by:
Hello, I recently read an interview with Bjarne Stroustrup in which he says that pure abstract classes should *not* contain any data. However, I have found that at times situations are when it...
10
by: Rahul | last post by:
Hi, I tried to create a abstract class by having a non-virtual member function as pure, but i got a compilation error saying "only virtual member functions can be pure"... I'm trying to think...
14
by: Jack | last post by:
Hi, I meet a question with it , I did not get clear the different betteen them, for example: #include <iostream>
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.