当前位置:网站首页>Typescript prevents base classes from being instantiated
Typescript prevents base classes from being instantiated
2022-07-28 23:28:00 【RemoteDev】
class BaseClass{
constructor() {
console.log(new.target,new.target == BaseClass);
// Prevent base classes from being instantiated
if (new.target === BaseClass){
throw new Error(' Base classes can only be inherited , Can't be instantiated ');
}
}
}
class SubClass extends BaseClass{
constructor() {
super();
}
}
//let bc = new BaseClass();// Base class instantiation prohibited , Will report a mistake
let sc = new SubClass();边栏推荐
- A new paradigm of distributed deep learning programming: Global tensor
- [image segmentation] vein segmentation based on directional valley detection with matlab code
- [mongodb] basic use of mongodb database, special cases, and the installation and creation process of mongoose (including the installation of mongoose fixed version)
- pgbench基准测试《postgresql》
- VR全景创业如何开拓市场?如何让创业之路更加顺畅?
- There are four ways for Nacos to configure hot updates and multiple ways to read project configuration files, @value, @refreshscope, @nacosconfigurationproperties
- High quality programming
- pg_ Installation and use of RMAN "PostgreSQL"
- 欲要让数字零售继续发挥作用,我们需要对数字零售赋予新的内涵和意义
- Basic concept of MySQL database and deployment of MySQL version 8.0 (I)
猜你喜欢
Object object

这个胶水有多强呢?

Subscript in swift

Xshell7, xftp7 personal free version official download, no need to crack, no activation, download and use

行泊一体迎爆发期,抢量产还是修技术护城河?

当初的“你“为什么做测试/开发程序员?自己存在的价值......

MyCms 自媒体商城 v3.6 发布,兼容微擎应用开发(Laravel框架)

Hands on Teaching of servlet use (1)

Submission records of frontiers Publishing House (with status changes)

华为无线设备配置利用WDS技术部署WLAN业务
随机推荐
Summary of core functions of software testing tool Fiddler postman JMeter charlse
Apk signature.Apk version information
Solve the exception that all control files are damaged
The safety dog has been selected into many details of cloud security panorama 2.0
【MySQL系列】 MySQL表的增删改查(进阶)
The US FCC provided us $1.6 billion to support domestic operators to remove Huawei and ZTE equipment
How to automatically install homebrew in China (domestic address)
Summary of koltin knowledge points
PCA learning
「行泊一体」放量,福瑞泰克高性能域控制器领跑新赛道
终端输出g_debug()信息
Pgbench benchmark PostgreSQL
这个胶水有多强呢?
The Gerrit local code is associated to the remote warehouse
【C语言】三子棋小游戏实现
Xshell7, xftp7 personal free version official download, no need to crack, no activation, download and use
Seagate released a new risc-v architecture processor: the performance of mechanical hard disk soared 3 times
Subscript in swift
Thesis reading (3) - googlenet of classification
The development mode of digital retail dominated by traffic is only the beginning