Introduction to OOP | Chapter 4: Classes and Methods: | next | previous | audio | real | text |
public class PlayingCard { public int rank { get { return rankValue; } set { rankValue = value; } } ... private int rankValue; }Omitting a set makes it read-only, omitting a get makes it write-only.