Skip to content

Instantly share code, notes, and snippets.

@hackjutsu
Created May 20, 2019 01:24
Show Gist options
  • Select an option

  • Save hackjutsu/7eaf9d550864c1f97904f1538c0f1b47 to your computer and use it in GitHub Desktop.

Select an option

Save hackjutsu/7eaf9d550864c1f97904f1538c0f1b47 to your computer and use it in GitHub Desktop.
[medium snippets] #medium #designPattern #CompositePattern
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