当前位置:网站首页>Typescript的构造方式
Typescript的构造方式
2022-06-21 16:52:00 【CupidoZ】
// 类对象
class Person2 {
readonly peo_type = '人类类型';
id: number=1000;
name: string='oooo';
constructor(id:number,name:string){
this.id = id;
this.name =name;
}
saySome(){
console.log('I say something!');
}
}
const p6 = new Person2(8888,'Jackey')
p6.saySome()
console.log(p6.id)
console.log(p6.name)
console.log(p6.peo_type);
ts为结构化对象提供了构造器 构造方式与其他面向对象语言的构造方式基本相同
边栏推荐
- 智慧三农数字王宁:适合初学者的前5日交易秘诀
- Use of list
- Node模块化管理
- nest.js实战之模块依赖传递性
- Mysql常见面试题
- PHP连接Mysql8.0报错:Illuminate\Database\QueryException
- 天天在都在谈的S3协议到底是什么?一文带你了解S3背后的故事
- Performance test ---locust's on_ Start and on_ Stop method
- Move Protocol Beta测试版进行时,瓜分生态核心权益MOMO
- Postman association to complete interface automation test
猜你喜欢

Win32com operation Excel

【ORACLE】Oracle里有“time”数据类型吗?--关于对Oracle数据类型的一点研究

【微服务|Nacos】快速实现nacos的配置中心功能,并完成配置更新和版本迭代

Stack awareness - stack overflow instance (ret2libc)

Node的全局安装

How to create your own AI creativity?
![[pwn基础]Pwntools学习](/img/67/6fb8a9628d5b750b0396f083aaeb91.png)
[pwn基础]Pwntools学习

Post Gartner webinar "nine questions on digital transformation"

带你区分几种并行

拦截器实现网页用户登陆
随机推荐
Byte Jump propose un nouveau type de réseau léger et efficace, mobovit, qui surpasse GhostNet et mobilenetv3 dans la classification, la détection et d'autres tâches CV!
EtherCAT igh master station controls Esther servo to return to zero
超分之RLSP
Node的字符处理
Vue.js+Node.js全栈开发教程:连接MySQL
System V IPC与POSIX IPC
About the basic operation of xlrd Library (for beginners)
RT thread persimmon pie M7 Quanzhi f133 DDR running xboot
我被变相降薪了
Win32com operation Excel
Stack cognition -- basic use of reverse IDA tools
Live broadcast platform development, live broadcast of each category and single example design display
带你区分几种并行
云安全日报220621:Ubuntu操作系统发现英特尔微码漏洞,需要尽快升级
Runmaide medical passed the listing hearing: it is expected that the loss will increase, with huoyunfei brothers holding about 33%
在线文档协作:办公必备高效率神器
Viewing technological changes through Huawei Corps (IV): interactive media (Music)
Seventy years of neural network: review and Prospect
Postman association to complete interface automation test
数字经济王宁教你如何正确地选择短期投资