We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Interfaces, public, etc...
Page Index Toggle Pages: 1
Interfaces, public, etc... (Read 1134 times)
Interfaces, public, etc...
May 8th, 2005, 1:18am
 
I'm trying to use interfaces, so that I can have two similar types of object, handled by a single "manager" class.

In this instance it's going to be "zombie" and "civilian" both implementing "creature"

One of the member functions, needs another custom type passing in as a parameter, in this case, an array of type "building"
I've managed to get all the methods that use standard objects, and processing objects to work, jsut not with custom ones.

here's a code snippet:
Code:
public interface creature
{
public void draw(PImage radar);
public void move(building[] city);
public boolean hit(float _x, float _y, float damage);
}


this gives the following error:

Code:
:/Documents and Settings/Administrator/Application Data/Processing/build/Temporary_7679_1028.java:648:20:648:27: Semantic Error: The static type "Temporary_7679_1028$creature" must use a qualified name to access the non-static member type "Temporary_7679_1028$building" of the enclosing type "Temporary_7679_1028". 



Now Java isn't my primary language, so I'm having trouble deciphering the error to know what I need to change about the interface, or about my "building" class to make it available for use, so any pointers will be gratefully recieved.
Re: Interfaces, public, etc...
Reply #1 - May 8th, 2005, 1:40am
 
since other tabs are embedded into the main file, it's getting confused.

when making your new tab, name it (or just rename it) creature.java which will mean 1) no access to drawing commands and 2) no preprocessor, but those shouldn't have much of any effect on an interface.
Re: Interfaces, public, etc...
Reply #2 - May 8th, 2005, 2:13am
 
Jsut tried that, unfortunately, since the draw method requires a PImage, being in a .java tab, makes that break.

I should be able to workaround this, by making the building array global, and accessing that way instead of passing a reference.
Re: Interfaces, public, etc...
Reply #3 - May 8th, 2005, 3:24am
 
add
import processing.core.*;
to the beginning of the tab.
Page Index Toggle Pages: 1