Solved

What does this code do?

Posted on 2000-02-24
3
183 Views
Last Modified: 2010-04-02

struct CInitTracing
{
      CInitTracing() { CControlPanelApp::bTRACE=TRUE; }
} foo;
0
Comment
Question by:SirSmokeALot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 2554544
It looks like t turns on tracing to be used when debugging.

when a CInitTracing object is created, its constructor is called.  This constructor sets bTRACE, which must be a static member variable of the CControlPanelApp class, to true.  so in othe words, but creating an object of CInitTracing, you are turning on tracing.  i.e just doing

CInitTracing CIT;

turns on tracing at that point in the program.
0
 

Author Comment

by:SirSmokeALot
ID: 2554698
Cool I thought constructors are only for classes.
0
 
LVL 22

Expert Comment

by:nietod
ID: 2554820
In C++ struct and class are completly the same. except for one insignificant difference.  In a struct, data members and base classes default to public and in a class they default to private.  Since you can overide the default in both struct and in class, they are functionally the same  i.e any class can be written as a struct--you just need to add a "private" or two--and any struct can be witten as a class--you just need to add a "public" or two.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

739 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