|
-
May 19th, 2004, 10:46 AM
#1
Thread Starter
Frenzied Member
Classes
I would like to create a class called "group" and within that class have an array of obects ("members')... Each member has two properties... name and id...
Here's my problem...
I am not sure how I would keep the array of member objects within the Group object...
And what is the syntax for the constructor of a new member?
Thanks,
Squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
May 19th, 2004, 10:54 AM
#2
Thread Starter
Frenzied Member
And one more thing...
Where in the world is the BinaryFormatter object?
Thanx,
Squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
May 19th, 2004, 11:59 AM
#3
Thread Starter
Frenzied Member
Update...
I found the binaryformatter...
it's in
System.Runtime.Serialize(something like that).Formatters.Binary.BinaryFormatter
or something to that effect 
Squirrelly1...
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
May 19th, 2004, 11:45 PM
#4
The BinaryFormatter object is what does Binary Serialization.
I would suggest using a collection instead of an array but I'll use an array since you mentioned it. You just make the array a property of the group object.
VB Code:
Public Class Member
Private _Id As Integer = 0
Private _Name As String = String.Empty
Public Property Id() As Integer
Get
Return _Id
End Get
Set(ByVal Value As Integer)
_Id = Value
End Set
End Property
Public Property Name() As String
Get
Return _Name
End Get
Set(ByVal Value As String)
_Name = Value
End Set
End Property
Public Sub New()
'default
End Sub
Public Sub New(ByVal id As Integer, ByVal name As String)
Me.Id = id
Me.Name = name
End Sub
End Class
Public Class Group
Private _Name As String = String.Empty
Private _Members As Member()
Public Property Name() As String
Get
Return _Name
End Get
Set(ByVal Value As String)
_Name = Value
End Set
End Property
Public Property Members() As Member()
Get
Return _Members
End Get
Set(ByVal Value As Member())
_Members = Value
End Set
End Property
Public Sub New()
'default
End Sub
Public Sub New(ByVal name As String, ByVal members() As Member)
Me.Name = name
Me.Members = members
End Sub
End Class
-
May 20th, 2004, 10:10 AM
#5
Thread Starter
Frenzied Member
What does the underscore represent in your code?
Oh, btw... I decided to use a collection... Those SOBs work wonders!!! LOL
Squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
May 20th, 2004, 09:37 PM
#6
The underscore doesn't mean a damn thing really its just my naming convention for member variables. Some people use m_ or an abbreviation of the type bln, str, int but I like just _.
-
May 20th, 2004, 10:06 PM
#7
Thread Starter
Frenzied Member
I knew it was a naming convention of sorts, but I had never seen it before... 
Squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|