Game Development Reference
In-Depth Information
public string Substring( int startIndex, int length);
public string Substring( int startIndex);
public int IndexOf( char c)
Suppose that you are the author of the string class and these methods have not
yet been implemented. Implement these three methods. You may not use any
existing methods carrying the same name, or other varieties of these methods
with these names, because we assume that these methods are not there yet. Apart
from these methods, you may use any other method in the string class, as well as
your own methods.
6. Classes and inheritance
Consider the following two classes:
class A{
public void Method1() { Console.WriteLine("A::Method1"); }
public virtual void Method2() { Console.WriteLine("A::Method2"); }
}
class B:A{
public void Method1() { Console.WriteLine("B::Method1"); }
public override void Method2() { Console.WriteLine("B::Method2"); }
}
What is the output of the following series of instructions?
Ax= new A();
Ay= new B();
Bz= new B();
x.Method1();
x.Method2();
y.Method1();
y.Method2();
z.Method1();
z.Method2();
7. Sidescrolling
Consider the following class:
class Scrolling : Game
{ GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D background;
Vector2 position;
public Scrolling()
{ graphics = new GraphicsDeviceManager( this );
Search WWH ::




Custom Search