Skip to content

Commit

Permalink
Revert "Geng geng geng (#253)"
Browse files Browse the repository at this point in the history
This reverts commit c374f7a.
  • Loading branch information
hcsp-bot committed Dec 5, 2021
1 parent c374f7a commit b5f2994
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 36 deletions.
23 changes: 0 additions & 23 deletions src/main/java/com/github/hcsp/inheritance/Animal.java

This file was deleted.

12 changes: 8 additions & 4 deletions src/main/java/com/github/hcsp/inheritance/Cat.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package com.github.hcsp.inheritance;

public class Cat extends Animal{
public class Cat {
private String name;

public Cat(String name) {
super(name);
this.name = name;
}

public void meow() {
super.call("喵");
public void sayMyName() {
System.out.println("我的名字是" + name);
}

public void meow() {
System.out.println("喵" + name);
}
}
11 changes: 7 additions & 4 deletions src/main/java/com/github/hcsp/inheritance/Dog.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package com.github.hcsp.inheritance;

public class Dog extends Animal{
public class Dog {
private String name;

public Dog(String name) {
super(name);
this.name = name;
}


public void sayMyName() {
System.out.println("我的名字是" + name);
}

public void wang() {
super.call("汪");
System.out.println("汪" + name);
}
}
12 changes: 7 additions & 5 deletions src/main/java/com/github/hcsp/inheritance/Rat.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package com.github.hcsp.inheritance;

public class Rat extends Animal{
public class Rat {
private String name;

public Rat(String name) {
super(name);
this.name = name;
}


public void sayMyName() {
System.out.println("我的名字是" + name);
}

public void zhizhi() {
super.call("吱吱");
System.out.println("吱吱" + name);
}

}

0 comments on commit b5f2994

Please sign in to comment.