|
-
Apr 30th, 2004, 02:00 AM
#1
Thread Starter
Frenzied Member
Need overloaded properties... kinda
Ok here is the deal, I have a class CProcess which has the responsibility to process another class called CList
I declare it like this:
dim myProcess as new CProcess
dim myList as new CList("1","7")
myProcess.List = myList <--- List is a property of CProcess
Now, I have another type I also want the CProcess class to handle which is called CListCollection (a class which inherited ArrayList). Can I overload the property List so I will handle both types?? I could do it with another property but it doesn't look good I think...
I and can only overload properties if they have different paramaters, not different return types
OR
which is really the best way to solve this?
kind regards
Henrik
Last edited by MrNorth; Apr 30th, 2004 at 02:05 AM.
-
Apr 30th, 2004, 04:07 AM
#2
Member
I would use the Polymorphic feature. Let define a base class from where inherits both class (CListCollection,CList) . Thus, you will be able tu use allways the same variable, regardless of whether wich object have you instantiated it.
Sorry for my english 
Álvaro
-
Apr 30th, 2004, 04:47 AM
#3
Thread Starter
Frenzied Member
yes something like this crossed my mind, but I have already inherited an arraylist to the CListCollection.. I can't inherit the base class also 
kind regards
Henrik
-
Apr 30th, 2004, 05:37 AM
#4
Member
You can do like this, the base class inherits an arraylist. Thus, the CList Class is a collection with only one element. I fint it good, it´s like an abstract Fabric Pattern design (really simple).
Alvaro
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
|