Results 1 to 3 of 3
Thread: affecting other classes
- 05-17-2012, 12:09 AM #1
Member
- Join Date
- May 2012
- Posts
- 11
- Rep Power
- 0
affecting other classes
I am trying to make a game. I have my main class, which has multiple objects of another class, I'll call it bobby. I want bobby to be able to call methods, or change variables in the main class. I don't know what this is called, so if there is another post like this I am sorry.
- 05-17-2012, 12:19 AM #2
Re: affecting other classes
Pass the other class a reference to the "main" class, say in its constructor, and save it in a class variable for any methd to use. The other class can use that reference to call the "main" class
If you don't understand my response, don't ignore it, ask a question.
- 05-21-2012, 11:30 PM #3
Member
- Join Date
- May 2012
- Posts
- 11
- Rep Power
- 0
Similar Threads
-
Association Classes for these classes
By kevinkhan in forum New To JavaReplies: 9Last Post: 03-21-2012, 05:22 PM -
Classes Help!!! two classes with object question.
By stuckonjava in forum New To JavaReplies: 16Last Post: 02-10-2012, 01:39 AM -
Use classes inside of other classes
By BlankFile in forum New To JavaReplies: 2Last Post: 02-06-2012, 01:51 PM -
resize image dimesion without affecting its RGB values
By Nixil in forum AWT / SwingReplies: 2Last Post: 03-03-2010, 07:30 AM -
Using a JAR from other classes
By Joe2003 in forum Advanced JavaReplies: 1Last Post: 01-02-2008, 07:08 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks