I have a Java quesion that is probrably pretty basic.
I am looking to create a class which has a child class. I want that child class to have a reference to it's parent class and vice-versa.
When initializing it, how to I create that connected reference in Java without pointers?
Would the constructor look like
Class1 class1 = new Class1();
class1.setClass2(new Class2(this));
In other words, how do I have a class pass a reference of itself to another class?
Thanks,
Bob
I am looking to create a class which has a child class. I want that child class to have a reference to it's parent class and vice-versa.
When initializing it, how to I create that connected reference in Java without pointers?
Would the constructor look like
Class1 class1 = new Class1();
class1.setClass2(new Class2(this));
In other words, how do I have a class pass a reference of itself to another class?
Thanks,
Bob