Skip to content

Commit b941c3d

Browse files
committed
Added Structural pattern folder
1 parent 9c9ee12 commit b941c3d

File tree

8 files changed

+24
-0
lines changed

8 files changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
1)Object at central is called Component and one wrapping component is call Decorator
3+
and one wrapping decorator is called Decorator
4+
2)Attach additional responsibilities to an object dynamically.
5+
*/
6+
7+
abstract class ok
8+
{
9+
abstract void m1();
10+
void m2()
11+
{
12+
System.out.println("This is data from m2");
13+
}
14+
}
15+
class DecoratorDemo extends ok {
16+
void m1()
17+
{
18+
System.out.println("This is frmo m1");
19+
}
20+
public static void main(String[] args) {
21+
DecoratorDemo obj = new DecoratorDemo();
22+
obj.m2();
23+
}
24+
}

0 commit comments

Comments
 (0)