I have 2 classes both non-static. I need to access a method on one class to return an object for processing. But since both classes is non-static, I cant just call the metho
By passing an instance to the constructor:
class Bar { private Foo foo; public Bar(Foo foo) { _foo = foo; } public void MethodCaller() { _foo.MethodToCall(); } }
Usage:
Foo foo = new Foo(); Bar bar = new Bar(foo); bar.MethodCaller();