DaveP said:
how do u keep a ownership chain of objects example below
class1=new class1()
class2=new class2()
how can i show a reference back to class2 from within class2
do i send class1 in as a parameter reference
That sentence doesn't make a great deal of sense.
Do you mean a reference back to class1 from within class2?
Your sample code shows no ownership at all.
Perhaps you can pseudocode something that looks like what you want to do.
Here is a simple program demonstrating an object holding a reference to
another object.
I don't know if this is what you are after...good luck
using System;
class Foo
{
static void Main(string[] args)
{
A a = new A();
a.X=5;
B b = new B(a);
Console.WriteLine("b.Foo():{0}",b.Foo());
a.X = 7;
Console.WriteLine("b.Foo():{0}",b.Foo());
}
}
public class A
{
private int x;
public int X { get{return x;} set {x = value;}}
}
public class B
{
private A a;
public B(A a)
{
this.a = a;
}
public int Foo()
{
return a.X;
}
}