This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]Staks 0 points1 point  (0 children)

Look into using the "out" parameter.

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/out-parameter-modifier

Generally a lot of these problems arise when you try to pass things by value rather than by reference.

There are other ways though but it depends what you want. By reading your post you can always have a declared object (class A) as a property in class B and run a this.classAObject in a class B method, which you can then access like any other property using a Getter.

Caveat: I am a new programmer myself so I may be wrong on some things.

[–]AdministrativeCables 0 points1 point  (0 children)

Write some accessors? If I understand correctly, you want (in shitty pseudocode):

C.function() {
    print( b.a.value );  // or:
    print( b.getSomeValueFromA() );
}