- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstrument.java
More file actions
Latest commit
29 lines (26 loc) · 791 Bytes
/
Copy pathInstrument.java
File metadata and controls
29 lines (26 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
publicclassInstrumentimplementsClonable {
Stringm_class;
Stringtype;
Stringfirm;
Stringname;
publicvoidprint() {
System.out.println("["+this.m_class+"] " + this.type + ' ' + this.firm + ' ' + this.name);
}
publicInstrument(Stringm_class, Stringtype, Stringfirm, Stringname) {
this.m_class = m_class;
this.type = type;
this.firm = firm;
this.name = name;
}
publicInstrument(Instrumenti){
this.m_class = i.m_class;
this.type = i.type;
this.firm = i.firm;
this.name = i.name;
}
// Паттерн прототип https://refactoring.guru/ru/design-patterns/prototype
@Override
publicInstrumentclone() {
returnnewInstrument(this);
}
}