using System.Collections.Generic;
public Bok(string titel, string författare, string typ)
public Roman(string titel, string författare, string typ) : base(titel, författare, typ)
public class Tidskrift : Bok
public Tidskrift(string titel, string författare, string typ) : base(titel, författare, typ)
public class Novellsamling : Bok
public Novellsamling(string titel, string författare, string typ) : base(titel, författare, typ)
static void Main(string[] args)
var myClass = new MyClass();
List<Bok> library = new List<Bok>();
Console.Write("Hej och välkommen till Biblioteket!\n");
Console.WriteLine("[1] Registrera ny bok");
Console.WriteLine("[2] Visa böcker");
Console.WriteLine("[3] Avsluta");
Console.Write("\nVälj: ");
Int32.TryParse(Console.ReadLine(), out choice);
Console.WriteLine("\nFel inmatning, försök igen!\n");
Console.Write("Titel: ");
string titel = Console.ReadLine();
Console.Write("Författare: ");
string författare = Console.ReadLine();
Console.WriteLine("Är boken en [1]Roman [2]Tidsskrift eller [3]Novellsamling ");
string typ = Console.ReadLine();
Int32.TryParse(Console.ReadLine(), out bokChoice);
Console.WriteLine("\nsparat!\n");
Bok b = new Roman(titel, författare, "(roman)");
Bok b = new Tidskrift(titel, författare, "(tidskrift)");
Bok b = new Novellsamling(titel, författare, "(novell)");
public static void Show(List<Bok> library)
Console.WriteLine("\tBibloteket är tomt\n");
foreach (Bok book in library)
Console.WriteLine("\t" + book.ToString());