Classes in TypeScript 1024x373 1 - Declaring Classes in TypeScript Angular 2

Declaring Classes in TypeScript Angular 2

Posted on

How you can Declare Lessons in TypeScript Angular 2

Classes in TypeScript 1024x373 - Declaring Classes in TypeScript Angular 2

On this submit we’ll see easy methods to declare a category in TypeScript angular 2. On this under code window you may see now we have declared class Level with two variables ‘x’ and ‘y’. We now have one methodology additionally inside Level class which is able to print each the purpose values of object.

Initializing the Class in TypeScript

On this under code snippet we’re creating one variable level with is of Sort Level class. Then we’re allocating reminiscence or creating object of sort Level through the use of new key phrase like another object oriented language.

We’re utilizing level variables to assign values to object variables ‘x’x and ‘y’. On the finish we’re calling doSomething() methodology of level object we simply created. Under is the results of above code.

 

Supply projectgeek.com