Overloaded indexed properties

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have a class with three overloaded indexed poperties.


Declaration in *.h

__gc class ByteArrayN : public FArrayN
{
typedef BYTE T;
typedef ByteArrayN FTArrayN;
 
Hi Michael,

Currently I am looking for somebody who could help you on it. We will reply
here with more information as soon as possible.
If you have any more concerns on it, please feel free to post here.


Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
Hi Michael,
the above row At[ ind3,ind2,ind1 ] always call the function get_At[ ind 1
].
According to the rules of C++ the above code is working as expected. C++
does have built-in support multi-dimensional arrays and thus a[e1, e2, e3]
is treated as a[(e1, e2, e3)], or once you apply the comma-expression rules
a[e3];

By the way, for Whidbey the compiler will be supporting multi-dimensional
CLR arrays and so with this release a[e1, e2, e3] will work the way the
user expects it to work.


Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
Just to make sure we don't confuse readers:
According to the rules of C++ the above code is working as expected. C++
does have built-in support multi-dimensional arrays and thus a[e1, e2, e3]
is treated as a[(e1, e2, e3)], or once you apply the comma-expression
rules
a[e3];
Gary meant to say that C++ does __NOT__ have built in rectangular
multi-dimensional arrays.

And if anyone is less familiar with the comma operator, it evaluates all
arguments left to right and then returns the last one.

Thanks.

Ronald Laeremans
Visual C++ team

"Gary Chang" said:
Hi Michael,
the above row At[ ind3,ind2,ind1 ] always call the function get_At[ ind 1
].
According to the rules of C++ the above code is working as expected. C++
does have built-in support multi-dimensional arrays and thus a[e1, e2, e3]
is treated as a[(e1, e2, e3)], or once you apply the comma-expression
rules
a[e3];

By the way, for Whidbey the compiler will be supporting multi-dimensional
CLR arrays and so with this release a[e1, e2, e3] will work the way the
user expects it to work.


Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no
rights.
 
Hi, Michael:

Here is what I have found out from the book <<Essential Guide to Managed
Extenstions for C++>> by Siva Challa:

A good property behaves like a data member. But there is things that we can
do with a data member but not with a property.

"An array property declaration shall not overload an indexed property."
Otherwise, we will have ambiguity problem.

It looks from your code, you have overloaded the array property. I would
suggest you to avoid overloading here.

Thanks!

Sally Lou

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top