Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- static class Program {
- Level [] levels = new Level [10];
- levels [0] = new Level1 ();
- foreach (var l in levels) {
- if (l != null) {
- Console.WriteLine(l.Name);
- }
- }
- }
- abstract class Level {
- public int Number { get; protected set; }
- public String Name { get; protected set; }
- }
- class Level1 : Level {
- public Level1 () {
- this.Number = 1;
- this.Name = "Level 1";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement