Chat on IRC |
User Defined Types
Posted by Brok3n_Link [send private reply] at July 13, 2002, 10:49:02 PM
Hi all,
I need some help with user defined types or the like. I need a Type, or something similar that allows me to have mutiple types? eg. Type PlayerCharacter Owner as string Name as string ' somemore stuff here LeftHand as HandType RightHand as HandType End Type type handtype end type
Posted by Zandalf [send private reply] at July 13, 2002, 11:40:29 PM
sounds like classes to me, but then again I'm just a C++ progger, so I'm unfamiliar with most other languages. what language are you trying to program in here, and maybe I'll (or someone else) will be able to help...
Posted by CodeRed [send private reply] at July 14, 2002, 01:25:43 AM
I'll assume you are using C++, you can do this two ways, with structs or with classes, it really doesn't matter which.
class Hand { private: whatever; public: whatever; }; class Player { private: string owner; string name; Hand leftHand; Hand rightHand; public: whatever; } I guess....
Posted by taubz [send private reply] at July 14, 2002, 07:13:31 PM
There's no reason why you can't do what you're doing (in VisualBasic I presume). Just make sure that if type A is within type B, A must appear in your code before B.
- taubz
Posted by AngelOD [send private reply] at July 15, 2002, 06:35:01 AM
Yup, taubz is right. Move the 'HandType' declaration above the 'PlayerCharacter' declaration, and it should work perfectly. :o)
Posted by Brok3n_Link [send private reply] at July 15, 2002, 06:45:28 AM
ah! has to be before eh?
ok that fixes the problem, thanx a lot. Brok3n Link brok3n@iinet.net.au
Register as a new user | ||||||||