The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
February 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

member vs method...

Posted by Yoo, Woo Jong on February 04, 2001 at 9:55 PM

in example,

class C1 {
priavte int x;
public setX(int p) {
x = p;
}
}
......
C1 cc1 = new C1();
C1 cc2 = new C1();
......

In C++, as i know, physically a member 'x' is located two other place(cc1 & cc2), but a method 'setX' is located one place. So compile-time after, 'cc1.setX(8)' and 'cc2.setX(9) are tranformed secretly to 'C1.setX(cc1,8)' and 'C1.setX(cc2.9)'...

In java ,like a C++, is a member independently located as the number of objects, and is a method shared by all same type object?
Other words, is a method physically located one place irrelatively the number of objects?



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us