Passing objects to objects
Today I ran into some funny bits of code. Something equal to this (without the helpful naming):
public class SomeClass {
private Object[] localName;
public SomeClass( Object[] localName ) {
this.localName = localName;
}
}
What happens here is that there's an object table constructed, and then the constructor method of the above class sets the local object table equal to the object table in the parameters.
This way this class will be able to take over a table of objects constructed outside of it, and access the methods and variables of the imported objects.
This way classes can access each other.
Etiketter: classes, constructor methods, constructors, Java, objects, tables

0 Kommentarer:
Legg inn en kommentar
Abonner på Legg inn kommentarer [Atom]
<< Startsiden