Constructor in TypeScript Part-7

In our previous post we have overview about Class & object in Type Script.Today we will learn about Constructor.


Constructor is one kind of special method. It is called when create object of class by default.


Bellow is the following code of Employee class

Call Employee class:Untitled

Fig: Create Object

Let get code explain:

Above code we see that there is a constructor which have two parameter.Once is firstName and other once is lastName. Both parameters are assigned FirstName and LastName which are attributes of Employee class.

Created Object of Employee class:


  • Multiple constructor implementations are not allowed.
  • If constructor is in class with parameter then without pass argument,Object create impossible.

Hope this will be helpful 🙂



Leave a Reply

Your email address will not be published. Required fields are marked *