All pastes #2085836 Raw Edit

Miscellany

public text v1 · immutable
#2085836 ·published 2011-09-30 09:24 UTC
rendered paste body
using System;
public class Bíll
{
	private string skráningarnúmer;
	private byte hraði;
	private static byte fjöldi;
	
	public Bíll()
	{
		skráningarnúmer = "óþekkt";
		hraði = 0;
		fjöldi++;
	
	}
	
	public Bíll(string n, byte h)
	{
		skráningarnúmer = n;
		hraði = h;
		fjöldi++;
	}
		
		
	public void Bílaupplýsingar()
	{	
		Console.WriteLine("Hraði bíls: " + hraði);
		Console.WriteLine("Skráningarnúmer bíls:" + skráningarnúmer);
		Console.WriteLine("Fjöldi skilgreindra bíla: " + fjöldi);
		Console.WriteLine();
	}
}
	
public class Bílaforrit
{
	public static void Main()
	{
		Bíll bill1 = new Bíll();
		bill1.Bílaupplýsingar();

		Bíll bill2 = new Bíll("UH 697", 50);
		bill2.Bílaupplýsingar();
		
		Bíll bill3 = new Bíll("YB 369", 90);
		bill3.Bílaupplýsingar();
	
		bill1.Bílaupplýsingar();
	}
	
}