Results 1 to 3 of 3
Thread: i need help with clases
- 10-23-2009, 08:27 AM #1
Member
- Join Date
- Oct 2009
- Posts
- 3
- Rep Power
- 0
i need help with clases
hi.
im creating a gui app in witch i create a class call customer_main ( my classes are JFrames )
form customer_main i call another class call order_details .
when i call order details i hide the customer_main class
now the problem is that i canot call the customer_main from withing order_Details with out creating another object.
i have to work with the same object from customer_main.
i really need help if you can help me any way i thank you in advance
ps. sorry for my tipos. im just learning english.
- 10-23-2009, 09:05 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
If two objects A and B need to know each other they can pass themself to the other object as a parameter of another method:
kind regards,Java Code:public class A { private B b; // we need to know it // introduce a B to this object A: public void iAmAB(B b) { this.b= b; } ... } public class B { public B(A a) { // B knows A because it passed itself as a parameter a.iAmAB(this); // show yourself } ... }
Jos
- 10-23-2009, 06:21 PM #3
Member
- Join Date
- Oct 2009
- Posts
- 3
- Rep Power
- 0


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks