首页 推荐 热点 专题 PHPJavaPythonAndriodIOSC#前端数据库人工智能程序开发架构安全运维资讯微课资源
0
点赞
收藏
分享

微信扫一扫

es6 class extends

天蓝Sea 2022-06-27 阅读 73
Java编程语言
class Person{
constructor(name) {
this.name=name
}
say(){
console.log('hi:'+this.name)
}
}
const p=new Person("howhy")
class Student extends Person{
constructor(name,grade) {
super(name)
this.grade=grade
}
study(){
console.log(this.name+" is on "+this.grade)
}
}
p.say();
const st=new Student("s1","33")
st.study()

 


举报
0 条评论
天蓝Sea
关注
  • ​CentOS 7 安装 net-tools.rpm 包步骤详解(附 rpm 命令和 yum 方法)​附安装包
  • 【工具】前端JS/VUE修改图片分辨率
  • 什么是 scikit-learn?
  • llama_cpp_python 启用CPU模式
  • leetcode 947. 移除最多的同行或同列石头
  • CSS3 圆角:打造现代网页设计的圆润之美
  • [C语言日寄] <stdio.h> 头文件功能介绍
  • Apache Hop从入门到精通 第三课 Apache Hop下载&安装
  • 转换流—InputStreamReader 和 OutputStreamReader
  • 开源三代示波器的高速波形刷新方案开源,支持VNC远程桌面,手机,Pad,电脑均可访问(2024-11-11)