ADVANCED TOPICS IN COMPILER DESIGN
CODE GENERATION FOR OBJECT ORIENTED LANGUAGES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
Consider the following method for a class Closet. Assume Closet objects contain Hanger objects and Shoe objects.Method:void update ( int z, String w ) Explanation:Adds Hanger or Shoe objects to the Closet object. If the value of w is “a", then z Hanger objects are added. If the value of w is “r", then z Shoe objects are added. Otherwise, nothing is done. Given that a Closet object myCloset has been declared and initialized, which of the following method calls is the correct way to add 10 Shoe objects to myCloset?
|
myCloset.update ( 10, “a” )
|
|
myCloset.update ( “a", 10 )
|
|
myCloset ←update ( 10, “r” )
|
|
myCloset.update ( 10, “r” )
|
Explanation:
There is 1 question to complete.