dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: C++
Expertise: Beginner
Sep 28, 1999

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Templates

Question:
I'm porting a UNIX app to NT; one of the class hierarchies includes something like this:

template 
class base
{
    // stuff
};

template 
class derived :
    public base,
public base { // stuff };
When I compile it in MSVC6 I get the following error:

c:\projects\test\test.cpp(14) : error C2500: 
'derived' : 'base'
is already a direct base class c:\projects\test\test.cpp(17) : see reference to class
template instantiation 'derived' being compiled
How can I get around this?

Answer:
Your code is prefectly legal and should compile on every ANSI/ISO compliant compiler. Unfortunately, MS VC6.0 is not fully compliant yet and therefore, it refuses to compile this snippet. I would suggest using another compiler instead, such as Borland C++ Builder 4.0 for example (which blissfully compiles this code).

Alternatively, you can modify your code but it seems like you will need to do a lot of work because the changes will affect other components and classes that use class 'derived'.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date