Solved

What does this code do?

Posted on 2000-02-24
3
184 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

728 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