|
-
Mar 13th, 2002, 09:30 AM
#1
Thread Starter
Hyperactive Member
(Resolved) - Class within a Class
We have created class modules and collections for
a project.
One Class is Called Project, it has several properties:
Customer, CustomerPhone#......
Each Project can have a Quality Assurance(class) which also
has it's own properties: Statement_of_Work, Batch_process....
The problem is that I want to access the Quality Assurance
Class from my Project Class Like So:
Dim MyProj as New Project
MyProj.QualityAssurance.Statement_of_work = "something"
---------this give me an error of Object not Set ------------
I can create New Projects and New Quality Assurances but
I cannot access them the way I stated above.
I am guessing that I have to link them somehow but I'm
not sure what to do.
Basically I just want to have a class within a class.
Any help is appreciated!!!
Last edited by jcfowl; Mar 13th, 2002 at 10:03 AM.
-
Mar 13th, 2002, 09:35 AM
#2
Hyperactive Member
The parent class needs interfaces to the child class properties.
-
Mar 13th, 2002, 09:38 AM
#3
Thread Starter
Hyperactive Member
Thanks for the Response
Could you be more specific. Do I need to place some
code inside the Initialize() statement of the Parent?
How do I set up the interfaces to the Child?
-
Mar 13th, 2002, 09:52 AM
#4
Hyperactive Member
However the child class initialises or sets a property the parent class needs to access this.
So if you want to set values of a child class on the initialisation of the parent class call the child classes properties from the parent class initialise method.
Heres a bad example.
If you have a class BOX and a class BIGBOX
BIGBOX contains 2 BOXs
A BOX has 1 variable mySize
So BOX has a property SIZE thats set its mySize.
If you initialise a BIGBOX you need to call the SIZE property of each of its BOXs to set them.
So the outside interface to each BOX is through a BIGBOX.
I can't believe I wrote that double dutch crap.
Can somebody else explain better please?
-
Mar 13th, 2002, 09:57 AM
#5
Frenzied Member
In class cProject:
Code:
Public Property Get QualityAssurance() As cQualityAssurance
Dim qaThis As New cQualityAssurance
'set qathis properties for this project..projectid?
Set QualityAssurance = qaThis
End property
Hope this helps,
Duncan
-
Mar 13th, 2002, 10:03 AM
#6
Thread Starter
Hyperactive Member
Great!
Thanks for the help.
I had the basic Idea but didn't really know how to do it.
with your examples i figured it out. Thanks a lot.
jcfowl
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
|