Answer the question
In order to leave comments, you need to log in
What does the get accessor do in this example?
Hello, who can explain what the word get does in this example? The code is from the book, and the role of the word get is not explained there.
private MemoryCard _secondRevealed;
public bool canReveal{
get { return _secondRevealed == null;} // Смысл этой строчки я не понял
}
Answer the question
In order to leave comments, you need to log in
canReveal will only return true if the _secondRevealed reference is not initialized.
And what is so difficult here? Compares a class field to null. Checks if the field is initialized or not. true - means that the field is not initialized.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question