double w, double h): base(s, w, h) {
color = c;
}
// , public void ShowColor() {
Console.WriteLine(" " + color);
}
}
class Shapes6 {
static void Main() {
ColorTriangle tl =
new ColorTriangle("", "", 8.0, 12.0); ColorTriangle t2 =
new ColorTriangle("", "", 2.0, 2.0);
Console.WriteLine(" tl: "); tl.ShowStyle(); tl. ShowDinv(); tl.ShowColor ();
Console.WriteLine (" " + tl.AreaO);
Console.WriteLine ();
Console.WriteLine(" t2: "); t2.ShowStyle(); t2.ShowDim(); t2.ShowColor();
Console.WriteLine(" " + t2.Area());
}
}
.
tl:
8 12 48
t2:
2 2 2
ColorTriangle Triangle TwoDShape, , . , .
: base . , base ColorTriangle Triangle, base Triangle TwoDShape. , , , .
: , , , ? , , ? , : . , base. , base , , .. . .
// .
Using System;
// , class {
|
|
public () {
Console.WriteLine(" .");
}
}
// , . class : { public () {
Console.WriteLine(" .");
}
}
/
// , . class : { public () {
Console.WriteLine(" .");
}
}
class OrderOfConstruction { static void Main() {
= new ();
}
}
.
.
.
.
, .
, . , , , , , . , .
, C# . , . , , , . , .
// .
class X { int ;
public X(int i) { a = i; }
}
class Y { int a;
public Y(int i) { a = i; }
}
class IncompatibleRef { static void Main() {
X x = new X (10);
X x2;
Y = new Y (5);
x2 = x; // , 2 = ; // ,
}
}
X Y , Y X, . - .
2 = ; // ,