Answer the question
In order to leave comments, you need to log in
Classes and Objects. Am I understanding this code correctly?
I have been trying to understand for a long time .. Well, in general, what and how I understood on the screen ..
I don’t really understand how it works and what the conditional operator does in this case? As a conv. does the op understand what is greater and what is less if they are not initialized? I've been breaking my head for 3 days already... Where did I get it wrong? Please explain to me to an inexperienced novice comrade)
Can you explain it step by step?
Answer the question
In order to leave comments, you need to log in
So shelves!
You described a new class. Min. In this class you have a FindMin method.
This method takes two numbers (this can be seen in the method definition - int minn, int max) and returns one of them. The one that is less. Where do the numbers come from in the method? Watch your hands)))
You create an instance of this class in line with new Min().
We remember that this class has a FindMin method that accepts two numbers.
You just call this method (it needs two numbers) and pass these numbers to it (it's 20, 10 in your code). The task of the method is to return a smaller number, which it does. The smaller number is assigned to the result variable (where it says “Moving ....” , only we don’t move anything, we just call the method, passing two numbers to it and get the result)
Mustache!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question