0 Members and 1 Guest are viewing this topic.
:AsmPrgm:BB6DEF404521A59DEF0A45EF7249EF4045C95368652047616D65
public abstract class Person{ public bool StrangersToLove { get; set; } public bool KnowTheRules { get; set; }}//Rick Astley's possible thoughtspublic enum Thought{ FullCommitment}//Rick class public sealed class Me : Person{ public Thought Thinking() { return Thought.FullCommitment; }}//The target of Rick's song, notice that GetThought can only be called by passing in an instance of Rick//which satisfies that she can't get this from any other guypublic class You : Person{ private Thought whatHeIsThinking; public void GetThought(Me guy) { whatHeIsThinking = guy.Thinking(); }}class Program{ //The first verse static void Main(string[] args) { var Rick = new Me() { KnowTheRules = true, StrangersToLove = false }; var Girl = new You() { KnowTheRules = true, StrangersToLove = false }; Girl.GetThought(Rick); }}