.


:




:

































 

 

 

 


Public int Width; public int Height;




public Rect(int w, int h) {

Width = w;

Height = h;

}

public int Area() {

return Width * Height;

}

}

class UseRect {

static void Main() {

Rect rl = new Rect(4, 5);

Rect r2 = new Rect(7, 9);

Console.WriteLine(" rl: " + rl.AreaO);

Console.WriteLine(" r2: " + r2.Area());

}

}

, .

return Width * Height;

Area () , Width Height, , , . .

return this.Width * this.Height;

this , Area (). , this.Width Width , this. Height Height . , Area () , this . this .

this . , . , Rect ()

Width = w;

Height = h;

.

this.Width = w; this.Height = h;

, . Rect, this.

Using System;

class Rect {

Public int Width; public int Height;

public Rect(int w, int h) { this.Width = w; this.Height = h;

}

public int Area() {

return this.Width * this.Height;

}

}

class UseRect {

static void Main() {

Rect rl = new Rect(4, 5);

Rect r2 = new Rect(7, 9);

Console.WriteLine(" rl: " + rl.AreaO);

Console.WriteLine(" r2: " + r2.Area());

}

}

this #, , . this . , C# , . . this. , C# Rect ().

public Rect(int Width, int Height) { this.Width = Width; this.Height = Height;

}

Rect () , , . "" this.

 

7

#. string, fore a ch.

. C# , , . , . , , , .

, . , , , , , , . , , .

C# , . : . ,

. , " ".

. . , .

foro , , C# . -, , . -, , new. , :

[] _ = new [];

. , . , . , . .

C++, , #. , , .

. int, , sample.

int[] sample = new int[10];

sample , new. , int.

, . :

int[] sample; sample = new int[10];

sample - , . .

: . C# . , sample 10 0 9. . , sample sample [ 0 ], sample [ 9 ]. , 10 sample.

// .

Using System;

class ArrayDemo {

static void Main() {

int[] sample = new int[10];

4 int i;

for(i =0; i < 10; i = i+1) sample[i] = i;

for(i = 0; i < 10; i &#9632;= i + 1)

Console.WriteLine("sample[" + i + "]: " + sample[i]);

}

}





:


: 2016-12-03; !; : 479 |


:

:

: , .
==> ...

2008 - | 1634 -


© 2015-2024 lektsii.org - -

: 0.011 .