简体   繁体   English

我如何制作打字稿模拟指针?

[英]how can i make typescript simulated pointer?

I want to simulated pointer "like in JAVA" to point to my new object of class in typescript or javascript 我想模拟“像在JAVA中一样”的指针,以指向我在打字稿或JavaScript中的类的新对象
see link below ? 看到下面的链接? http://postimg.org/image/9za5xagoj/ http://tinypic.com/r/fdet8p/9 http://postimg.org/image/9za5xagoj/ http://tinypic.com/r/fdet8p/9

 class Asset{
item:string
mainBeneficiary: EntitlementArray[];
equalshare:boolean
substituteSet: EntitlementArray[];  
    }

assets:Asset ;
//points  to only "Asset"  
pointer : Asset; 

Is this what you are looking for? 这是你想要的?

var pointer = Asset; 
var instance = new pointer()

View Example on TypeScript-Playground here 在此处查看有关TypeScript-Playground的示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM