mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-12 16:15:23 +00:00
Just formatting App classes to be like the other class files on the project
This commit is contained in:
1 parent
52f0923df9
commit
bde5b343d0
24 files changed
+466
-508
No files matched your search
@@ -1,26 +1,24 @@
|
||||
package com.iluwatar;
|
||||
|
||||
/**
|
||||
*
|
||||
* Decorator pattern is more flexible alternative to
|
||||
* subclassing. The decorator class implements the same
|
||||
* interface as the target and uses composition to
|
||||
*
|
||||
* Decorator pattern is more flexible alternative to subclassing. The decorator
|
||||
* class implements the same interface as the target and uses composition to
|
||||
* "decorate" calls to the target.
|
||||
*
|
||||
*/
|
||||
public class App
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
|
||||
System.out.println("A simple looking troll approaches.");
|
||||
Hostile troll = new Troll();
|
||||
troll.attack();
|
||||
troll.fleeBattle();
|
||||
|
||||
System.out.println("\nA smart looking troll surprises you.");
|
||||
Hostile smart = new SmartTroll(new Troll());
|
||||
smart.attack();
|
||||
smart.fleeBattle();
|
||||
public class App {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
System.out.println("A simple looking troll approaches.");
|
||||
Hostile troll = new Troll();
|
||||
troll.attack();
|
||||
troll.fleeBattle();
|
||||
|
||||
System.out.println("\nA smart looking troll surprises you.");
|
||||
Hostile smart = new SmartTroll(new Troll());
|
||||
smart.attack();
|
||||
smart.fleeBattle();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user