static void PrintInfo(object obj) { /* if (obj is ISocializable ) * { * ISocializable iso = (ISocializable)obj; * iso.depart(); * iso.wish(); * return; * } */ if (obj is ISocializable && obj is IEmotionable) { ISocializable iso = (ISocializable)obj; IEmotionable imo = (IEmotionable)obj; iso.depart(); iso.wish(); imo.cry(); imo.laugh(); return; } if (obj is IEmotionable && !(obj is ISocializable)) { IEmotionable imo = (IEmotionable)obj; imo.cry(); imo.laugh(); return; } }
private static void atTheParty(IEmotionable e, ISocializable s) { Console.WriteLine("\nAt The Party : "); e.cry(); e.laugh(); s.wish(); s.depart(); }