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;
- namespace Pawel
- {
- public abstract class Plyta
- {
- public string autor;
- public string tytul;
- public double cena;
- public Plyta(string a, string t, double c)
- {
- this.autor = a;
- this.tytul=t;
- this.cena=c;
- }
- public virtual void Opis()
- {
- }
- public class CD : Plyta
- {
- public CD(string a, string t, double c)
- : base(a, t, c)
- {
- }
- public override void Opis()
- {
- System.Console.WriteLine(autor + " nagral plyte o tytule: " + tytul + ", która kosztuje " + cena + " zl");
- }
- }
- public class DVD : Plyta
- {
- int rok;
- public DVD(string a, string t, double c, int r)
- : base(a, t, c)
- {
- this.rok = r;
- }
- public override void Opis()
- {
- System.Console.WriteLine(autor + " jest rezyserem filmu " + tytul + ", ktory kosztuje " + cena + " i został nagrany w roku " + rok);
- }
- }
- static void Main(string[] args)
- {
- CD kompakt = new CD("Paweł Puzio","Puzon - Greatests Hits", 29);
- DVD film = new DVD("Nikodem Jedynak","YYYGGH",13,1945);
- kompakt.Opis();
- film.Opis();
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement