Delete core-java-modules/core-java-lang-oop-patterns/src/main/java/com/baeldung/shallowdeepcopy/School.java
This commit is contained in:
parent
9f1ce56f82
commit
002def2d24
|
@ -1,22 +0,0 @@
|
|||
package com.baeldung.shallowdeepcopy;
|
||||
|
||||
class School {
|
||||
private String schoolName;
|
||||
public School(School sc) {
|
||||
this(sc.getSchoolName());
|
||||
}
|
||||
public School(String schoolName) {
|
||||
this.schoolName = schoolName;
|
||||
}
|
||||
// standard getters and setters
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
try {
|
||||
return (School) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
return new School(this.getSchoolName());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue