[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Different base class for debug & release

Posted on 1998-04-13
4
Medium Priority
?
234 Views
Last Modified: 2010-04-10
VC5, WinNt4.0

I would like to do the following.  How can i code it?

I have a CClassC.
In debug setting, i want its base class to be CClassA.
In release setting, i want its base class to be CClassB.
CClassB is derived from CClassA.
0
Comment
Question by:nancytan
  • 3
4 Comments
 
LVL 10

Accepted Solution

by:
RONSLOW earned 200 total points
ID: 1184261
use a #define

0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1184262
#ifdef _DEBUG
#define BASE CClassA
#else
#define BASE CClassB

class CClassC : public BASE {
...
};

0
 

Author Comment

by:nancytan
ID: 1184263
How do i code if i also want in the debug mode to skip
certain functions.  These functions are to be
processed during the Release setting only.



0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1184264
same way ... use the pre-processor with #ifdef _DEBUG/#else/#endif

You can make the release and debug versions as different as you want .. they could be completely different programs if you like .. but that may not help you much :-)

0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question