share data among objects in a class

Apr 9, 2011 at 1:34pm
Let's say I have a class called myClass that will have a variable called commonData. Objects myOjectA and myOjectB are from myClass.

When I assign / update the value of commonData for myObjectA, all ojbects that have derived from myClass (myObjectB, etc.) will also have the same commonData value as myObjectA. Is it possible?

Apr 9, 2011 at 1:40pm
Make the commonData static:
static int commonData;
Last edited on Apr 9, 2011 at 1:46pm
Apr 13, 2011 at 3:36am
That was it. Appreciated!
Topic archived. No new replies allowed.