|
-
Oct 22nd, 2002, 03:31 PM
#1
Thread Starter
Hyperactive Member
Object Programming Question (Resolved)
Hello,
I've set up an object, and am trying to nest other objects. However, it seems that it won't work. Can anyone help?
Example Code (in a .BAS Module):
Public Type AObj
Param1 as Integer
Param2 as Integer
End Type
Public Type BObj
Params as AObj
End Type
Public BigObject as BObj
When using this, I can enter:
a = BigObject.Params
The following won't work:
a = BigObject.Params.Param1
a = BigObject.Params.Param2
Any Ideas on how to make this work?
I'm using VB6-SP5
Thanks,
Ken
Last edited by Ken Whiteman; Oct 24th, 2002 at 05:13 PM.
-
Oct 22nd, 2002, 03:54 PM
#2
Sleep mode
1-does vb6 support oop & Inheritence ?I don't think so
2-Don't you have to use class to build your code ?(I think you have to) ?
If this is wrong plz let me know .
Pirate
-
Oct 22nd, 2002, 04:01 PM
#3
Thread Starter
Hyperactive Member
I Know VB6 doesn't support inheritance, but I'm not sure about oop.
I'm not sure why I'de need to use Class Builder (I'm not very good with class).
Ken
-
Oct 22nd, 2002, 05:33 PM
#4
Does this work?
VB Code:
a = BigObject.Params
b = a.Param1
b = b.Param2
I'm pretty sure this "nesting" of types works in VB6, I've done it before......
-
Oct 22nd, 2002, 05:58 PM
#5
Lively Member
a = BigObject.Params.Param1
It would not work because of type mismatch
a is a type of BObj and BigObject.Params.Param1 is an integer.
It shuld be
a.Param1 = BigObject.Params.Param1
In general you are confusing UDT and objects that are not the same thing
You can use inheritance technigue in VB. Read about keuword Implements
-
Oct 24th, 2002, 05:07 PM
#6
Thread Starter
Hyperactive Member
Resolved!
Split,
You are correct, I am working with UDT's.
When you "Nest" UDT's, all subordinates of each of the UDT's must be fully functional and correct, or else none of the UDT will work. Also, each subordinate must have at least 1 item.
Thanks all,
Ken
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
|