Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Will class member data automatically update...

This topic is 5298 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

...if I were to do something like this?
class Foo

 int x = 1;
 int y = 1;
 int z = x * y;


 Set_XY(int x, int y);

If I used Set_XY to change the values of x and y, will z automatically update? This is one of those threads where half-way through typing it I realized two things: a) This is a stupid question. b) I can easily figure it out myself by programming a test. And yet here I will press the post button anyway to as to preserve this dingleberry of wisdom on GameDev''s immortal server.

Share this post

Link to post
Share on other sites
In any case even if it did compile and you could use non-constant it wouldnt work.

Why? Because the initalisation only would occore when the class object was created. The function has to update the z value. Of course, all this is impossble!

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!