473,513 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to return reference in cli

Hi!

Does anyone knows how to get the same functionality like in
native c++ code shown below, in cli. To be more precise I don't
know what to write in place of question marks in cli code below.
Any ideas?
Thx!
//native c++
class MyClass
{
private:
int **conteiner_;
//...
int& Bridge_(int r, int c)
{
return conteiner_[r][c];
}
public:
//...
int& operator()(int r, int c)
{
return Bridge_(r, c);
}
};

//c++/cli
ref class MyClass
{
private:
array<int,2>^ conteiner_;
//...
??? Bridge_(int r, int c)
{
return conteiner_[r, c];
}
public:
//...
??? operator() (int r, int c)
{
return Bridge_(r, c);
}
};

main()
{
MyClass mc(...);
int i = mc(1,1);
}

P.S. I don't wont use property in cli, I need operator().

Best regards,
Zoran Stipanicev.

Feb 5 '06 #1
1 1085
Zoran Stipanicev wrote:
//c++/cli
ref class MyClass
{
private:
array<int,2>^ conteiner_;
//...
??? Bridge_(int r, int c)
{
return conteiner_[r, c];
}
public:
//...
??? operator() (int r, int c)


Perhaps
int% operator()(int r, int c)

To crete a reference to a managed (ref class or value) type, use the %
symbol.

Tom
Feb 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
28110
by: Wang Tong | last post by:
Suppose I have a function foo() and a class definition myClass, and I want to create an instance of myClass and return it from foo(). I guess the most efficient way is to return a reference to the...
3
1588
by: Zork | last post by:
Hi, I am a little confused with const functions, for instance (here i am just overloading the unary+ operator) if i define: 1) Length Length :: operator+ ( void ) const {return * this;} ... I...
5
3728
by: klaus triendl | last post by:
hi, recently i discovered a memory leak in our code; after some investigation i could reduce it to the following problem: return objects of functions are handled as temporary objects, hence...
25
4115
by: cppaddict | last post by:
I'd like to know what goes on under the hood when methods return objects. Eg, I have a simple Point class with two members _x and _y. It's constructor, copy constructor, assignment operator and...
14
2001
by: Gama Franco | last post by:
Hi, I'm designing an interface for a shared library, and I would like to know if there is a standard about how to return an object to the user. I will use exceptions to report errors, so there...
5
3029
by: Neal Coombes | last post by:
Posted to comp.lang.c++.moderated with little response. Hoping for better from the unmoderated groups: -------- Original Message -------- Subject: Return appropriately by value, (smart)...
12
4103
by: Jose Fernandez | last post by:
Hello. I'm building a web service and I get this error. NEWS.News.CoverNews(string)': not all code paths return a value This is the WebMethod public SqlDataReader CoverNews(string Sport)...
20
6930
by: weston | last post by:
I've got a piece of code where, for all the world, it looks like this fails in IE 6: hometab = document.getElementById('hometab'); but this succeeds: hometabemt =...
2
2337
by: Eric Lilja | last post by:
Hello, consider this complete program: #include <iostream> #include <string> using std::cout; using std::endl; using std::string; class Hanna {
12
2079
by: huangshan | last post by:
hi all In what condition i need( or mast) a (templates)function return value by reference? can you give me a example thanks
0
7260
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7539
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5686
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5089
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
456
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.