Created
May 20, 2019 01:24
-
-
Save hackjutsu/7eaf9d550864c1f97904f1538c0f1b47 to your computer and use it in GitHub Desktop.
[medium snippets] #medium #designPattern #CompositePattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Developer implements Employee { | |
| private String name; | |
| private double salary; | |
| public Developer(String name, double salary) { | |
| this.name = name; | |
| this.salary = salary; | |
| } | |
| public void add(Employee employee) { | |
| // Intentionally left blank | |
| } | |
| public Employee getChild(int i) { | |
| return null; | |
| } | |
| public String getName() { | |
| return name; | |
| } | |
| public double getSalary() { | |
| return salary; | |
| } | |
| public void print() { | |
| System.out.println(); | |
| System.out.println("Name =" + getName()); | |
| System.out.println("Salary =" + getSalary()); | |
| } | |
| public void remove(Employee employee) { | |
| // Intentionally left blank | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment