Introduction to OOP | Chapter 4: Classes and Methods: | next | previous | audio | real | text |
enum Suits {Spade, Diamond, Club, Heart}; class PlayingCard { public Suits suit () { return suitValue; } public int rank () { return rankValue; } private Suits suitValue; private int rankValue; }C# class definitions have minor differences, no semicolon at end, enum cannot be nested inside class, and visibility modifiers are applied to methods and data fields individually.