Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ООП
- {
- class Program
- {
- static void Main(string[] args)
- {
- Behaviour[] behaviours =
- {
- new Mover(),
- new Jumper()
- };
- while (true)
- {
- foreach (var behaviour in behaviours)
- {
- behaviour.Update();
- }
- }
- }
- }
- class Behaviour
- {
- public virtual void Update()
- {
- }
- }
- class Mover : Behaviour
- {
- public override void Update()
- {
- Console.WriteLine("Moving");
- }
- }
- class Jumper : Behaviour
- {
- public override void Update()
- {
- Console.WriteLine("Jumping");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement