I have a Object Oriented question.
I got two forms - Form1 and Form2. I also got two classes Class1 and
Class2
Form1 has objects Object1 - instance of Class1 and Object2 - instance
of Class2.
When i load Form1, i load this form and instantiate Object1 and
Object2. Please note Object1 and Object2 can be fairly large because of
several variables.
On a button on Form1, i want to load Form2 and on it is a listbox that
would display the contents of Object1 and Object2.
So my Form2 also has variables - Object1 and Object2 defined.
Now if i pass these objects in the constructor to Form2, will Form2
create a copy of these objects in memory or will it reference the same
object of Form1??
In short, How do i make Form2 reference the same objects (Object1 and
Object2) of Form1.
I know how CSharp does it. Would it make two copies of Object1, one for
Form1 and one for Form2?
Any help is greatly appreciated.
Thanks,
- Sam