Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Java invoker

Name: Anonymous 2012-12-01 19:13

In Java, is it possible to get the invoker of a class? I am trying to create two classes simultaneously but I want them to reference each other, preferably upon creation(constructors) if possible. I know I can sort of do it by returning the stack trace, but this doesn't exactly seem... proper. Any ideas /prog/?

Name: Anonymous 2012-12-01 19:33

>>9
So you're assuming that you create an object inside of another, and want to store that.

Do you see how confused that is?

Take a step back, stop worrying about OOP and objects, and think about the logic of your program. You have two classes. They need to talk about each other. Does it really make sense for the MVC paradigm to link them all together from the start? No, it doesn't. That's missing the point.

Abstract your logic. Take it out of the class. The class is just a data structure, like any other.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List