Class / Class within Class/ & Array problems
Hello,
I seem to be having some trouble with Classes & arrays etc...
So my structure is as follows:
Code Code:
Class1
--Method
--Method
--Class2.Property
--Class2.Property
--Class2.Class3.Property
--Class2.Class3.Property
But Assuming Class2 needs to be an Array(0 to 10) thats when we have problems assigning things!!
Dim test as Class2
Set test = new class2
test = myFunction(myString)
where myFunction is:
myFunction(test as string) as Class2
dim dummyObg AS CLASS2
set dummyOBg as new class2
redim dummyobj(0 to 10)
'code
'code
myFunction = dummyobj
end Function
Do i have to copy each array separately?
i.e array(0) = testarray(0)
array(1) = testarray(1)
etc.. etc..
Can't you just do: array = testarray ?
Re: Class / Class within Class/ & Array problems
How can Class2 be an array? It's a Class.
Skinny this down to a very simple example and maybe we'll be able to see where you have gone wrong.
It would not hurt a bit to STOP. Then go read the manual on Programming with Objects which you can also find in your MSDN CDs.
Re: Class / Class within Class/ & Array problems
The above was off of my head, rather than copy/paste from the actual project :)
Actually I need a break to get my head around!!
You right! How can a class be a array!!
I need an object referencing the class and that to be an array :)
Im basically trying to strip things down, rather than have many objects etc...
I need: i.e Class2 being an array would be nice
Class1.Class2(3).Method.Class3.Value
Re: Class / Class within Class/ & Array problems
Do i have to copy each array separately?
i.e array(0) = testarray(0)
array(1) = testarray(1)
etc.. etc..
Can't you just do: array = testarray ?
All you have to do is to give it a try. Then you will see what works and what doesn't work.
A class cannot be an array but you can have an array of classes.
Class1.Class2(3).Method.Class3.Value
Looks like something I saw in a Java or C/C++ program.
Class1 creates instances of Class2 and is refering to the 3rd instance. Is that what you are intending it to be?
Class2 has a method called Method (in your example)
Method has an instance of Class3 and Class3 has a property called Value
So, I guess you have this:
Class1.Class2(3).Method.Class3.Value
Is this what your intentios are?
I don't know if that will work or not.