Solved

What does this code do?

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

struct CInitTracing
{
      CInitTracing() { CControlPanelApp::bTRACE=TRUE; }
} foo;
0
Comment
Question by:SirSmokeALot
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now