Class and Object in TypeScript || Using Object in Class

In this video,I explained how to use object in class in TypeScript. Feel free to comment. For more, please subscribe and press the BELL icon. Please visit my Angular Playlist . Please visit my YouTube Video. The code is as follows -

object.ts - 
class Point {  // Point - class
  x: number;
  y: number;

  draw (){
    console.log('X:- ' + this.x + ', Y:- '+ this.y + ', X + Y :- ' + (this.x + this.y) );
  }
}

let point = new Point ;  // point - Object
point.x = 50;
point.y = 100;
point.draw();


Comments

Popular posts from this blog

CSS - Inline Type in CSS

Simple Program Using TypeScript || Program in TypeScript