Superfly1611
Well-known member
Hello all,
For those that frequent the c# forum on gotdotnet this may look familiar
Im trying to rewrite a c# program in vb.net as kind of a learning exercise into OO concepts in programming.
The c# Class including its current constructors is as below....(incase you couldnt guess im re-writing a 2D-Game)
The problem im having is replicating the ": this(...)" parts of the classes in vb.net.
So far thanks to help from peeps on c# forum ive got so far....
I just dont know how to emulate the this(..) part of the c#
If it helps according to meago on c# board (gotdotnet) an explanation of that statement is....
"Sprite(...) : this(...) tells C# to first call the same "Sprite" routine that matches the parameters enclosed in this(...) and then after executing that code return control back to this Sprite(...) routine and execute it..."
Can anyone help?
For those that frequent the c# forum on gotdotnet this may look familiar
Im trying to rewrite a c# program in vb.net as kind of a learning exercise into OO concepts in programming.
The c# Class including its current constructors is as below....(incase you couldnt guess im re-writing a 2D-Game)
Code:
public class Sprite
{
public Sprite(Device device, string image) : this(device, image, 1)
{
}
/// <summary>
/// Allows the creation of a sprite given a filename and a number of
/// frames. The bitmap is assumed to be divided up into (frames) evenly-
/// sized sections horizontally, with each section consituting a single
/// frame of the animation.
/// </summary>
public Sprite(Device device, string image, int frames) :
this(device, new Bitmap(image), frames)
{
}
/// <summary>
/// Allows the creation of a sprite given a Bitmap object and a
/// number of frames. The bitmap is assumed to be divided up into
/// (frames) evenly- sized sections horizontally, with each
/// section consituting a single frame of the animation.
/// </summary>
public Sprite(Device device, Bitmap image, int frames)
{
//Game Code
}
}
So far thanks to help from peeps on c# forum ive got so far....
Code:
Public Class Sprite
Allows the creation of a sprite given just a DirectDraw Device
object and the name of a file where a bitmap lives. The bitmap
is assumed to have only a single frame.
Public Sub New(ByVal device As Device, ByVal image As String)
frames = 1
End Sub
Allows the creation of a sprite given a Bitmap object and a
number of frames. The bitmap is assumed to be divided up into
(frames) evenly- sized sections horizontally, with each
section consituting a single frame of the animation.
Public Sub New(ByVal device As Device, ByVal image As String, ByVal frames As Integer)
End Sub
Public Sub New(ByVal device as Device, ByVal image as Bitmap, ByVal frames as integer)
Game Code
End Sub
End Class
I just dont know how to emulate the this(..) part of the c#
If it helps according to meago on c# board (gotdotnet) an explanation of that statement is....
"Sprite(...) : this(...) tells C# to first call the same "Sprite" routine that matches the parameters enclosed in this(...) and then after executing that code return control back to this Sprite(...) routine and execute it..."
Can anyone help?