// Client public static void Start() { Console.WriteLine(@"Friendly Robot's Info:"); var friendlyRobot = new FriendlyRobot(5, 10) { Softness = 10 }; friendlyRobot.ShowInfo(); Console.WriteLine(); Console.WriteLine(@"Friendly Robot copy Info:"); if (friendlyRobot.Clone() is FriendlyRobot friendlyRobotCopy) { friendlyRobotCopy.ShowInfo(); } Console.WriteLine(); Console.WriteLine(@"Hostile Robot's Info:"); var hostileRobot = new HostileRobot(2, 2) { Aggressiveness = 20 }; hostileRobot.ShowInfo(); Console.WriteLine(); Console.WriteLine(@"Hostile Robot copy Info:"); if (hostileRobot.Clone() is HostileRobot hostileRobotCopy) { hostileRobotCopy.ShowInfo(); } }
private HostileRobot(HostileRobot source) : base(source.ArmsCount, source.LegsCount) { Aggressiveness = source.Aggressiveness; }