com.perisic.shadow.example.mains
Class Redefine
java.lang.Object
com.perisic.shadow.example.mains.Redefine
- public class Redefine
- extends java.lang.Object
This example shows how a shadow can be used to
to redefine the behaviour of an object.
Fabian smiles differently the second time then the
first time becaues the SmileShadow
redefines smiling.
public class Redefine {
public static void main(String [] args) {
NiceFellow fabian = new NiceFellow("Fabian");
fabian.call("smile",1);
fabian.addShadow(new SmileShadow());
fabian.call("smile", 1);
fabian.call("printMood");
}
}
- First version: 16.03.2004
-
Copyright: (c) Marc Conrad, 2004
-
See http://perisic.com/shadow for information about this package.
- The com.perisic.shadow library is distributed under the terms of the
GNU Lesser General Public License (LGPL).
- If you require the package under a different licence please contact me.
- disclaimer: The classes are provided "as is".
There is no warranty implied by using the com.perisic.shadow package.
- Note: This class needs Java 1.5 for succesfull compilation. Compile this
class with the command javac -source 1.5
Method Summary |
static void |
main(java.lang.String[] args)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Redefine
public Redefine()
main
public static void main(java.lang.String[] args)