The following class definition is given. We want the show () method to invoke the get () method, and then output the value the get () method returns. Which of the invocations should be used instead of XXX?
I'm not entirely sure about this one. The wording of the question is a bit tricky, and I'm not 100% confident in my understanding of how instance methods work in this context. I'll need to review my notes on class definitions and method invocation before I can give a definitive answer.
Okay, I think I've got it. The key here is that the question wants us to use the "show()" method to invoke the "get()" method and output the result. Since "get()" is an instance method, we need to call it on the self object, so the answer is B - print(self.get()).
Hmm, I'm a bit confused here. The question mentions invoking the get() method, but it doesn't specify where that method is defined. Is it a method of the class in the image, or is it a separate function? I'll need to think this through carefully before answering.
This looks like a pretty straightforward question. I think the answer is B - print(self.get()). The question states that we want the show() method to invoke the get() method, and then output the value it returns. Since get() is an instance method, we need to call it on the self object.
Portia
3 months agoKate
3 months agoEzekiel
4 months agoRessie
4 months agoShayne
4 months agoDaron
4 months agoEleonore
4 months agoKattie
5 months agoHelaine
5 months agoRene
5 months agoSusana
5 months agoMariann
5 months agoMyra
5 months agoSage
1 year agoJudy
1 year agoPearlie
1 year agoEileen
1 year agoSimona
1 year agoPortia
1 year agoJesusa
1 year agoErin
1 year agoLindsey
1 year agoCatina
1 year agoDevorah
1 year agoBrett
1 year agoJillian
1 year agoMargot
1 year agoKerry
1 year agoMaia
1 year agoRoselle
1 year agoRoselle
1 year agoSheridan
1 year ago