Præsentation er lastning. Vent venligst

Præsentation er lastning. Vent venligst

Objekter og klasser Applikationsdesign Code Namespace Value og reference typer Reference type Rasmus D. Lehrmann1.

Lignende præsentationer


Præsentationer af emnet: "Objekter og klasser Applikationsdesign Code Namespace Value og reference typer Reference type Rasmus D. Lehrmann1."— Præsentationens transcript:

1 Objekter og klasser Applikationsdesign Code Namespace Value og reference typer Reference type Rasmus D. Lehrmann1

2 2.NET applikationer er ikke stand-alone.exe- programmer APP.exe CLR JIT Compiler obj code OS Process Underlying OS and HW FCL

3 Rasmus D. Lehrmann3 BusinessPresentationData AccessData Applikationsdesign

4 Rasmus D. Lehrmann4 namespace klasser public class konto { protected double saldo; protected int kontoNr; public konto(int kontoN, double nSaldo) //CT { saldo = nSaldo; kontoNr = kontoN; } public double Saldo { get { return saldo; } } public int KontoNr { get { return kontoNr; } }

5 Rasmus D. Lehrmann5 namespace klasser class Program { static void Main(string[] args) { konto akonto = new konto(1, 10000); System.Console.WriteLine("saldo " + akonto.Saldo); System.Console.ReadLine(); }

6 Rasmus D. Lehrmann6 Namespace Strukturering af programmet. Visual Studio bruger programmets navn som namespace Giver en mulighed for at bruge de samme navne flere steder

7 Rasmus D. Lehrmann7 Value og reference typer Value types Short Int …. Reference types String object ….

8 Rasmus D. Lehrmann8 Konto k1, k2, k3; k1 = new Konto(1, 1000); k2 = new Konto2, 2000); k3 = null; // Intet k3 = k1; // k3 refererer til det samme som k1 if (k1 == k2)… // referer de til det samme? if (k1.Equals(k2))… // sammenligner værdi Reference type


Download ppt "Objekter og klasser Applikationsdesign Code Namespace Value og reference typer Reference type Rasmus D. Lehrmann1."

Lignende præsentationer


Annoncer fra Google