by
82k 39
2
7
3,431
0
Top 1% !
Popular
Famous
Tagged
Easy-to-find
Specified
OpenSource
Popularity: 3626th place
Created
Modified Mar 6, 2014

Published on:

LanguageTypeScript
LicenseMIT_X11

Typescript basic class

Classes in typescript can contain properties and functions and can be instantiated by typescript code or directly in javascript.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/1658/Typescript-basic-class?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
// TypeScript class Student { // Properties are public by default firstName: string; lastName: string; id: int; // Constructor constructor( name: string, lastName: string, id: int) { this.firstName = name; this.lastName = lastName; this.id = id; } } // You can instantiate the Student from javascript or typescript in // the same way. var aStudent = new Student('john','Smith', 1024 );

Other Steps and Solutions

If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus