当前位置:网站首页>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为结构化对象提供了构造器 构造方式与其他面向对象语言的构造方式基本相同
边栏推荐
- [Oracle] is there a "time" data type in oracle-- Research on Oracle data types
- I got a pay cut in disguise
- 堆栈认知——栈溢出实例(ret2text)
- Deeply understand the attention mechanism of map
- Runmeide Healthcare a réussi l'audience d'inscription sur la liste: les pertes devraient augmenter, Huo Yunfei Brothers détenant environ 33%
- EtherCAT igh master station controls three Delta asdaa2 servo rotating circles
- 怎么安装 Laravel
- 主动学习(Active Learning) 概述、策略和不确定性度量
- 结构建模设计——Solidworks软件之特征成型中旋转切除与圆角倒角功能实战总结(绘制一个沉头螺丝孔)
- 智慧三农数字王宁:适合初学者的前5日交易秘诀
猜你喜欢

How to create your own AI creativity?

EtherCAT master station based on am4377 controls STM32 slave station

Stack awareness - stack overflow instance (ret2text)

Operation of simulation test platform for test questions bank of R1 quick opening pressure vessel operation certificate in 2022

Stm32f1 and stm32subeide programming example - linear Hall effect sensor driver

EtherCAT object dictionary analysis

POSIX共享内存

AI自己写代码让智能体进化!OpenAI的大模型有“人类思想”那味了
![LeetCode 1108 IP地址无效化[暴力] HERODING的LeetCode之路](/img/c6/d3eb6cee92b1c0848bf3d3b58b8b22.png)
LeetCode 1108 IP地址无效化[暴力] HERODING的LeetCode之路

Zhong'an insurance, together with Alibaba health and huiyitianxia, explores a new model of Internet chronic disease management
随机推荐
Threejs实现波动热点效果,波动标记,波动标签显示
Differences between WCDMA and LTE
POSIX共享内存
2022 high altitude installation, maintenance and removal work license question bank and simulated examination
WXML模板语法、WXSS模板样式、全局配置、页面配置和网络数据请求
How can multidimensional analysis pre summary work?
论文笔记 ACL 2022|Unified Structure Generation for Universal Information Extraction
Typescript接口
Xlrd finds the row of the specified content and its content
基本文件操作
在线文档协作:办公必备高效率神器
POSIX创建终止线程
Server socket program
Cann training camp Season 2 - the opening ceremony | it starts at 7:30 tonight on time. You can't miss it!
Reids面试题集合 数据结构+穿透雪崩+持久化+内存淘汰策略+数据库双写+哨兵
[pwn基础]Pwntools学习
Operation of simulation test platform for test questions bank of R1 quick opening pressure vessel operation certificate in 2022
企业高管收入杂谈
STM32F1与STM32CubeIDE编程实例-线性霍尔效应传感器驱动
Technical architecture of large websites | information encryption technology and key security management