|
-
Jan 22nd, 2004, 08:04 PM
#1
Thread Starter
New Member
Structuring Properties???
I am writing some large classes that have alot of properties that could be catorgized
eg.)
Person
>FirstName
>LastName
>Address
>>Postalcode
>>pobox
>>Street
>>Apartment
this is just an example my class is not as simple as this :
They way i was thinking of doing this is nested classes:
VB Code:
Class Person
Class Address
Public Property Street() as String
'whatever>
End Property
End Class
End Class
-
Jan 22nd, 2004, 09:31 PM
#2
Fanatic Member
Why not make Address a stand alone class so that it can be reused outside of Person, for say Building.
-
Jan 22nd, 2004, 10:17 PM
#3
Sleep mode
lol , what's your question ?
-
Jan 22nd, 2004, 10:29 PM
#4
Thread Starter
New Member
I wanted to know if this is the proper way of doing it.
-
Jan 22nd, 2004, 10:36 PM
#5
Frenzied Member
Do what VBCrazyCoder said. Make each class separate and use inheritance.
-
Jan 22nd, 2004, 10:36 PM
#6
Sleep mode
If these obje have any relation to each other then put them in one class , this class contains the obj and their properties .
-
Jan 22nd, 2004, 11:13 PM
#7
PowerPoster
Originally posted by Pirate
If these obje have any relation to each other then put them in one class , this class contains the obj and their properties .
I am not sure I understand you correctly, but I think you are saying that if they have a relationship, they should be in the same class. That would be bad OO programming if you did that. Person should be a class that is seperate from the Address class. Then, the person object can expose a Address object as a property, and so could any other object that could possibly have an address associated with it. For example, Building, as mentioned above, has a physical address. Or how about a piece of equipment you are keeping track of where it is at, it should have an Address associated with it also.
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
|