4.2. Implementing inheritance

A subclass must also observe the first and second rules. It inherits its identifier property from the superclass, Cat.

package eg;

public class DomesticCat extends Cat {
        private String name;

        public String getName() {
                return name;
        }
        protected void setName(String name) {
                this.name=name;
        }
}