H
Henke
I have this scenario.
public class A
{
public int numbers;
public class A()
{
}
public void SomeMethod()
{
B b = new B();
b.Check();
}
}
public class B
{
public class B()
{
}
public boolCheck(A a);
{
if(a.numbers > 10)
return true;
return false;
}
}
That is Class A creates a new instance of Class B. On that object it calls a
method Check with a reference to it's self (Class A) as a parameter. In the
check method the numbers member is read from the passed object a. This
obviously creates a circualr dependency. In C++ this could be solved by
including Class A's header file in Class B's implementation file, but how
should this be solved in C# or am I doing a logic error here?
Thanks in advance!
/Henke
public class A
{
public int numbers;
public class A()
{
}
public void SomeMethod()
{
B b = new B();
b.Check();
}
}
public class B
{
public class B()
{
}
public boolCheck(A a);
{
if(a.numbers > 10)
return true;
return false;
}
}
That is Class A creates a new instance of Class B. On that object it calls a
method Check with a reference to it's self (Class A) as a parameter. In the
check method the numbers member is read from the passed object a. This
obviously creates a circualr dependency. In C++ this could be solved by
including Class A's header file in Class B's implementation file, but how
should this be solved in C# or am I doing a logic error here?
Thanks in advance!
/Henke