Hi Lakesider,
you can pass the reference of class A to B in its constructor, then B will
be able to call A.Refresh(), like:
class A
{
public void DoSomething()
{
B bInst = new B(this);
bInst.SomeMethod();
}
public void Refresh()
{
}
}
class B
{
private A _aInst;
public B(A aInst)
{
_aInst = aInst;
}
public void SomeMethod()
{
//do work
_aInst.Refresh();
}
}
Or you could pass in a Reference to A in the method you call on B, if you
want to limit the scope of the A reference inside of B.
You could have A call Refresh on itself once it has finished calling the
method in B which updates the map values, but I wouldn't recommend this
baceause then class A needs to know what B is doing internally which is not a
good thing, it should not be A who is aware of this but rather class B.
Hope that helps
Mark R Dawson
http://www.markdawson.org
"Lakesider" wrote:
Hi NG,
my problem is: I have a class A with a map on it. There is a public
methode "Refresh" for this map. Within A i call a class B (new B). In B
I modify some things, that would need to do a refresh in A.
My question: HOW can I call A.refresh() from B???
What is here a "best practice"?
Thank you very much
Rudi