My question is based on class relationships. I've written code for 2 classes, one of the "public int..." bits in 1 class has a variable which holds the cost of something. In the other class a variable holds the weight of something. I want to multiply the weight with the cost. Any help guys?
asif49 9 Posting Whiz in Training
Recommended Answers
Jump to PostMy question is based on class relationships. I've written code for 2 classes, one of the "public int..." bits in 1 class has a variable which holds the cost of something. In the other class a variable holds the weight of something. I want to multiply the weight with the …
Jump to PostUnless Class1 and Class2 are nothing more than simple data structures, the convention is to write getters that return those values rather than declaring them public. i.e.
class1thing.getValue()
All 6 Replies
asif49 9 Posting Whiz in Training
DarkLightning7 12 Junior Poster in Training
DarkLightning7 12 Junior Poster in Training
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
asif49 9 Posting Whiz in Training
DarkLightning7 12 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.