Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication3
- {
- class Character
- {
- private string Name;
- private string Type;
- public string GetName
- {
- get { return Name; }
- }
- public string GetType
- {
- get { return Type; }
- }
- public Character(string name, string type)
- {
- Name = name;
- Type = type;
- }
- public void Draw()
- {
- Console.WriteLine("{0} {1}", Name, Type);
- }
- }
- class Warrior : Character
- {
- public int pancerz;
- public string nazwa;
- public Warrior(string name, int pan) : base(name, "warrior")
- {
- pancerz = pan;
- nazwa = name;
- }
- public void SetArmorLevel(int wartosc)
- {
- pancerz = wartosc;
- }
- public void GetArmorLevel()
- {
- Console.WriteLine(pancerz);
- }
- public new void Draw()
- {
- Console.WriteLine("{0} {1} {2}", this.nazwa, this.GetType, this.pancerz);
- }
- }
- class Enemy : Character
- {
- public string imie;
- public int level;
- public int liczba;
- public Enemy(string name, int sila, int lbPrzeciwnikow) : base (name, "enemy")
- {
- imie = name;
- level = sila;
- liczba = lbPrzeciwnikow;
- }
- public new void Draw()
- {
- Console.WriteLine("{0} {1} {2}", this.imie, "enemy", this.level, this.liczba);
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Character ch1 = new Character("Jonasz", "ork");
- ch1.Draw();
- Warrior w1 = new Warrior("Janek", 120);
- w1.Draw();
- w1.SetArmorLevel(20);
- w1.GetArmorLevel();
- Enemy e1 = new Enemy("Józek", 30, 2);
- e1.Draw();
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement