How the watches of CodeBlocks show variables from within a class?
6 replies to this topic
#1
Posted 26 July 2011 - 07:17 PM
|
|
|
#2
Posted 27 July 2011 - 06:29 PM
Um...care to clarify what exactly you mean by that? What would you like to do?
sudo rm -rf /
#3
Posted 27 July 2011 - 07:35 PM
Debug shows:
Local Variables
Function Arguments
How do I watche the variables that were created within the class ?
Local Variables
Function Arguments
How do I watche the variables that were created within the class ?
#4
Posted 27 July 2011 - 07:40 PM
You watch the class variable and should be able to expand it to see the member variables. For example:
You would watch bar, the function argument, and baz, the local variable. I haven't used this in a while, but if it's anything like Visual Studio, that's how it'll work.
void foo(OtherClass& bar)
{
MyClass *baz = new MyClass();
// other stuff
}
You would watch bar, the function argument, and baz, the local variable. I haven't used this in a while, but if it's anything like Visual Studio, that's how it'll work.
sudo rm -rf /
#5
Posted 27 July 2011 - 07:45 PM
dargueta said:
You watch the class variable and should be able to expand it to see the member variables. For example:
You would watch bar, the function argument, and baz, the local variable. I haven't used this in a while, but if it's anything like Visual Studio, that's how it'll work.
void foo(OtherClass& bar)
{
MyClass *baz = new MyClass();
// other stuff
}
You would watch bar, the function argument, and baz, the local variable. I haven't used this in a while, but if it's anything like Visual Studio, that's how it'll work.
I'm talking about private variables
class Test{
private:
int var;
.
.
.
I have Test.cpp that handles the variable var. How can I watches this variable ?
#6
Posted 27 July 2011 - 08:14 PM
Yes, that's exactly what I meant. Going with my example:
1) While debugging, right-click on baz.
2) Select Watch 'baz'
3) In the Watch window you'll see something like baz = (MyClass *)0x804b008.
4) Right-click on that, and select Dereference 'baz'.
Beneath that will appear an expandable tree with all of the member variables, including the private ones.
1) While debugging, right-click on baz.
2) Select Watch 'baz'
3) In the Watch window you'll see something like baz = (MyClass *)0x804b008.
4) Right-click on that, and select Dereference 'baz'.
Beneath that will appear an expandable tree with all of the member variables, including the private ones.
sudo rm -rf /
#7
Posted 28 July 2011 - 05:00 PM
dargueta said:
Yes, that's exactly what I meant. Going with my example:
1) While debugging, right-click on baz.
2) Select Watch 'baz'
3) In the Watch window you'll see something like baz = (MyClass *)0x804b008.
4) Right-click on that, and select Dereference 'baz'.
Beneath that will appear an expandable tree with all of the member variables, including the private ones.
1) While debugging, right-click on baz.
2) Select Watch 'baz'
3) In the Watch window you'll see something like baz = (MyClass *)0x804b008.
4) Right-click on that, and select Dereference 'baz'.
Beneath that will appear an expandable tree with all of the member variables, including the private ones.
Ok. Thank you
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









