C#C
C#4y ago
LukeJ

Cannot set readonly field in inherited constructor [Answered]

Title says it all really, I'm not really sure why given this is clearly a constructor.
public class StandardCard : Card {
    public StandardCard(Suite suite, Rank rank) {
        if (!StandardRanks.ranks.Contains(rank))
            throw new Exception();

        this.suite = suite;
        this.rank = rank;
    }
}
Was this page helpful?