473,395 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

change object reference

Does anyone know if there is a way to change the way the reference that
is returned from an object? I need to return an object member when
someone tries to retrieve "this".
e.g.:

//Suppose we have the object FooBar...

class Foobar{
private string m_someStuff;
private FooBar m_anotherInstance;
Mar 23 '06 #1
2 1325
Dnia 23-03-2006 o 14:48:46 felipecsl <fe*********@gmail.com> napisał:
Does anyone know if there is a way to change the way the reference that
is returned from an object? I need to return an object member when
someone tries to retrieve "this".
e.g.:

//Suppose we have the object FooBar...

class Foobar{
private string m_someStuff;
private FooBar m_anotherInstance;
.
.
.
}

//and we want to pass it as a parameter to another function:

FooBar fb = new FooBar();
MyFunc(fb);

//what I want, is fb.m_anotherInstance to be passed as parameter to
MyFunc(). is this possible?

[PD] What you want to do is a kind of code obfuscation :) But if you
really want you can do something like this (you will have to use the a
second type):
class a
{
b b;

public static implicit operator b(a a)
{
return a.b;
}
}

class b
{
...
}

This way when you will call MyFunc(b b) with param a you will effectively
pass a.b as a param.

--
Piotr Dobrowolski
Piotr.Dobrowolski@_usun_gmail.com
Mar 23 '06 #2
thanks Piotr.. i'll try that!

Mar 23 '06 #3

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

Similar topics

11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
7
by: EsCHEr | last post by:
I created a class public class testClass { public testClass() { } public void changeForm(){ Form1.textBox1.Text = "hello"; }
5
by: Ram | last post by:
Hey, I'v managed to set the "User Must Change Password At Next Logon" flag on the LDAP protocol, Using the - "pwdLastSet" property - by setting it to - "0" (for on) or - "-1" (for off). The...
1
by: Leo | last post by:
I created a user control which is some text contained in a HtmlTable. I put this control into main form. I would like to have the ability to move this control around in the main form. I think one...
19
by: Woody Splawn | last post by:
I have a form who's height I would like to change in code. I would have supposed something like the following would work but it does not: Me.Size.Height = 292 I get "Expression is a value and...
3
by: Andy | last post by:
If I use Visual Studio.Net 2003 to generate "web references" for clients using either sproxy.exe (for C++) client or wsdl.exe (for C#) clients, the web service endpoint gets "baked" into the...
1
by: ken | last post by:
Hi, How do you change the font for the data labels on your bar graph report/chart? I have 24 series, and when I change the font of the data label for one series that does not change them all......
7
by: dotnetnoob | last post by:
i keep getting Object references not set to an instance of an object from this code: Private Sub EqBinding() Dim x As Integer x = 0 Do If CStr(arlsType.Item(x)) = "Bacnet Point" Then Dim...
17
by: Summercool | last post by:
I wonder which language allows you to change an argument's value? like: foo(&a) { a = 3 } n = 1 print n
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.