<a href="http://faq.javaranch.com/java/UseCodeTags" target="_blank">Use Code Tags!!</a>
Joanne
Originally posted by Joanne Neal:
It helps if you post code that actually compiles, but in answer to your question classb is a reference to a classB object and when you call a constructor or method you pass a copy of that reference.
if newRemote = classb, in the constructor of ClassA; can I access the ClassB object via newRemote ie; newRemote.doStuff(); from any public method?
<a href="http://faq.javaranch.com/java/UseCodeTags" target="_blank">Use Code Tags!!</a>
--------------------------------------------------------------------------------
if newRemote = classb, in the constructor of ClassA; can I access the ClassB object via newRemote ie; newRemote.doStuff(); from any public method?
--------------------------------------------------------------------------------
Yes absolutely, but not the private members/methods.
Should I declare it like ClassB newRemote = new ClassB();
or ClassB newRemote;?
I know I read somewhere that objects have access to private methods/members of another obj of the same type.
<a href="http://faq.javaranch.com/java/UseCodeTags" target="_blank">Use Code Tags!!</a>
Originally posted by Tom Johnson:
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
<a href="http://faq.javaranch.com/java/UseCodeTags" target="_blank">Use Code Tags!!</a>
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
<a href="http://faq.javaranch.com/java/UseCodeTags" target="_blank">Use Code Tags!!</a>
This is my favorite show. And this is my favorite tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|