|
-
Jan 28th, 2006, 10:56 AM
#1
[RESOLVED] Inheriting an ArrayList
I'm trying to make my own collection based off the ArrayList class and I got a question.
If someone references a specific item in my ArrayList class, I want to do something to the Object. In C++ I'd probably overload the [] operator, modify the object and then return it(like what would normally hapen).
-
Jan 28th, 2006, 11:18 AM
#2
Re: Inheriting an ArrayList
Don't inherit the ArrayList class. The CollectionBase class exists solely as a base class for your own strongly-typed collections. Use that instead. You would basically provide the same members as the ArrayList class but strongly-typed to the type of your choice. Internally CollectionBase maintains an ArrayList, so your members call the corresponding members of the InnerList or List property. You are then basically wrapping an ArrayList rather than inheriting the class.
-
Jan 28th, 2006, 12:13 PM
#3
Re: Inheriting an ArrayList
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
|