D
darksquid42
Hi folks,
I'm trying to do the C# equivilent of the following and it's driving
me up the wall.
// assign base-class portion of an object to a given reference
class base
{
public:
int a;
};
class derived : public base
{
public:
int b;
};
void main(void)
{
derived d;
d.a = 10;
d.b = 20;
base b;
b.a = 30;
((base&) d) = b; d.a becomes 30
}
This comes up b/c I need access to the Client property of a TcpClient
and (unchangable) code I'm interfacing with passes me an already
connected TcpClient. I simply want to do something like this:
class TcpClientEx:TcpClient
{
TcpClientEx(TcpClient alreadyConnectedClient)
{
((TcpClient)this) = alreadyConnectedClient; // won't
compile
}
Socket getClient() { return Client; }
}
I feel like I'm missing something obvious -- can somebody help me out?
Thanks!!
larry
I'm trying to do the C# equivilent of the following and it's driving
me up the wall.
// assign base-class portion of an object to a given reference
class base
{
public:
int a;
};
class derived : public base
{
public:
int b;
};
void main(void)
{
derived d;
d.a = 10;
d.b = 20;
base b;
b.a = 30;
((base&) d) = b; d.a becomes 30
}
This comes up b/c I need access to the Client property of a TcpClient
and (unchangable) code I'm interfacing with passes me an already
connected TcpClient. I simply want to do something like this:
class TcpClientEx:TcpClient
{
TcpClientEx(TcpClient alreadyConnectedClient)
{
((TcpClient)this) = alreadyConnectedClient; // won't
compile
}
Socket getClient() { return Client; }
}
I feel like I'm missing something obvious -- can somebody help me out?
Thanks!!
larry