假设我们有一类动物,
call: ColorText (color code hex) "Hello World!"
:ColorText
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
goto :eof
和一类机器人,
class Animal {
name: string;
constructor(name: string) {
this.name = name;
}
eat() {
console.log(this.name + " is a Animal and is eating");
}
}
那么如何让Animal的实例具有Robot类的类型呢?
class Robot {
name: string;
constructor(name: string) {
this.name = name;
}
}
并且还注意到在动物类中有一个额外的方法,所以它怎么可能?