Need help :( ClassB and ClassA have no special relationship; they are two separa
ID: 663775 • Letter: N
Question
Need help :(
ClassB and ClassA have no special relationship; they are two separate classes both used by the same main(). void methodB( ClassA aObj ) is a method ofclassB. It takes a ClassA object as an ordinary parameter. The client, main(), calls methodB().
Here is an outline of the situation:
Check all the true statements (Check all that apply):
A. If methodB() modifies aObj's someMemb, the client's myObjA's someMemb will also be modified, accordingly, when the method returns.
B. If methodB() modifies aObj's someMemb, the client's myObjA's someMemb will not be modified when the method returns.
C. methodB() can change aObj's someMemb value through direct assignment, as in aObj.someMemb = something.
D. methodB() can read (access) aObj's someMemb value directly without changing it, as in something = aObj.someMemb.
E. methodB() can read from (access) and/or write to (change) aObj's someMemb indirectly through appropriate public ClassA methods, if ClassA offers such methods.
Explanation / Answer
B. If methodB() modifies aObj's someMemb, the client's myObjA's someMemb will not be modified when the method returns.
C. methodB() can change aObj's someMemb value through direct assignment, as in aObj.someMemb = something
D. methodB() can read (access) aObj's someMemb value directly without changing it, as in something = aObj.someMemb.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.