Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package domain;
- public class Customer extends Person {
- private String custNbr;
- public Customer(String custNbr, String name, String surname, Address address) {
- super(name, surname, address);
- this.setCustNbr(custNbr);
- }
- public String getCustNbr() {
- return custNbr;
- }
- private void setCustNbr(String custNbr) {
- this.custNbr = custNbr;
- }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- Customer customer = (Customer) o;
- return custNbr.equals(customer.custNbr);
- }
- @Override
- public int hashCode() {
- return custNbr.hashCode();
- }
- @Override
- public String toString() {
- return "CustNbr: " + custNbr + " " + super.toString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment