[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Debugger support for the C++ grammar includes all of the C operators
described in the previous section entitled Operators for the C Grammar. In
addition to this, the debugger supports a variety of C++ operators which are
described in the C++ Programming Language manual.
Perhaps the best way to illustrate the additional capabilities of the
debugger's support for the C++ grammar is by way of an example. The
following C++ program encompasses the features of C++ that we will use in
our debugging example.
Example:
// DBG_EXAM.C: C++ debugging example program
struct BASE {
int a;
BASE() : a(0) {}
~BASE(){}
BASE & operator =( BASE const &s )
{
a = s.a;
return *this;
}
virtual void foo()
{
a = 1;
}
};
struct DERIVED : BASE {
int b;
DERIVED() : b(0) {}
~DERIVED() {}
DERIVED & operator =( DERIVED const &s )
{
a = s.a;
b = s.b;
return *this;
}
virtual void foo()
{
a = 2;
b = 3;
}
virtual void foo( int )
{
}
};
void use( BASE *p )
{
p->foo();
}
void main()
{
DERIVED x;
DERIVED y;
use( &x );
y = x;
}
Compile and link this program so that the most comprehensive debugging
information is included in the executable file.
Online resources provided by: http://www.ClipX.Net --- NG 2 HTML conversion by Dave Pearson