|
-
September 22nd, 2005, 06:06 PM
#1
Overloading the [] operator
I am working with a mix of C# and Managed C++ in my project.
I need to know what the syntax is to overload the [] operator.
My class derrives from System::ArrayList. The documents say that the Item property is an overload to the index subscript [].
What is the syntax in C++ to define this in my derrived class? I can't find anything on this and I can not see any op_... to use for this.
Anyone know how to do it?
-
September 22nd, 2005, 11:53 PM
#2
Re: Overloading the [] operator
See how operator[] is implemented in ArrayList class:
Code:
C#
public virtual object this[int index]
{get; set;}
C++
public: __property virtual Object* get_Item(
int index
);
public: __property virtual void set_Item(
int index,
Object*
);
Use the same C++ prototype.
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
|