Sign in to follow this  
basil_fawlty

point operator?

Recommended Posts

Hey Everyone, I have a small problem with the point operator. In another class I have initialized some variables. Now I want them to use. So the normal procedure is: class1.variable_x But what if I want to use the negative of variable_x or to increment it class1.-variable_x ??? class1.varible_x++ ??? These lines above are not working. How can I do it? Thanks for your help Cheers

Share this post


Link to post
Share on other sites
-x.y

If you have variable y, located in x, then the name of y is "x.y". Same for all other dereferences. The name of z could be "A::B->c->d.x.z".

Share this post


Link to post
Share on other sites
You can always wrap stuff in parens to disambiguate the meaning for your compiler and for yourself.

--(foo.bar);
-(A::B->c->d.x.y.z);
(*(foo->Bar::baz))++;

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this