Game Development Reference
In-Depth Information
bool
[,] tetrisblock = ...
this
.Print(tetrisblock);
this
.HorizontalMirror(tetrisblock);
this
.Print(tetrisblock)
(b) Also implement the
Print
method. This method writes the contents of a two-
dimensional boolean array to the console, in the way it is done in the exam-
ples given in this exercise.
4.
Abstract classes
Given are the following classes:
abstract class
A
{
public abstract void
Method1();
public void
Method2()
{
return
;
}
}
class
B:A
{
public override void
Method1()
{
return
;
}
public void
Method3(A a)
{
a.Method1();
}
}
Indicate for each of the following instructions whether or not it is allowed:
A obj;
obj =
new
A();
obj =
new
B();
obj.Method1();
obj.Method2();
obj.Method3(obj);
B otherObject = (B)(
new
A());
A yetAnotherObject = (A)obj;
obj.Method3(otherObject);
A[] list;
list =
new
A[10];
list[0] =
new
A();
list[1] =
new
B();
List<A> otherList =
new
List<A>();