Java代码,由Component派生出CPU类(CPU)和显卡类(Vedio)。CPU类增加了新的属性:核心数,Vedio类增加了属性:显存。
时间: 2023-07-16 09:14:23 浏览: 176
Basic-Vedio-editor:使用基本视频编辑器
以下是Java代码:
```
import java.awt.Component;
public class CPU extends Component {
private int coreCount;
public CPU(int coreCount) {
this.coreCount = coreCount;
}
public int getCoreCount() {
return coreCount;
}
public void setCoreCount(int coreCount) {
this.coreCount = coreCount;
}
}
public class Vedio extends Component {
private int memorySize;
public Vedio(int memorySize) {
this.memorySize = memorySize;
}
public int getMemorySize() {
return memorySize;
}
public void setMemorySize(int memorySize) {
this.memorySize = memorySize;
}
}
```
阅读全文