> For the complete documentation index, see [llms.txt](https://eece.gitbook.io/mist-innovation-club-flutter-course-1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://eece.gitbook.io/mist-innovation-club-flutter-course-1/dart-fundamentals-1/constructor/parameterised-constructor/basic-parameterised-constructor.md).

# Basic Parameterised Constructor & "this" keyword -2

{% embed url="<https://youtu.be/mrnJLOhVDlc>" %}

{% hint style="info" %}
Due to naming conflict we use "this" keyword inside parameterised constructor. If there is no naming conflict you can remove the "this" keyword . But it's good practice to always use the "this" keyword&#x20;
{% endhint %}

```dart
void main() {
  // Parameterised Constructor 

  
  //var employee1 = Employee();
  
  
  var employee1 = Employee(1, "John", "Doe", "CTO", 12);

  print(employee1.id);
  print(employee1.firstname);
  print(employee1.lastname);
  print(employee1.position);
  print(employee1.number_of_day_worked);
}

class Employee {
  int id;

  String firstname;

  String lastname;

  String position;

  int number_of_day_worked;
  
  
  


  //  Parameterised Constructor - 1
  
  
 
   Employee(id, firstname, lastname, position, number_of_day_worked) {
    this.id = id;
    this.firstname = firstname;
    this.lastname = lastname;
    this.position = position;
    this.number_of_day_worked = number_of_day_worked;
   }
  
  
  
  
    

  //  Parameterised Constructor   - we avoid the following to be consistent  

//    Employee(a, b, c, d, e) {
//     id = a;
//     firstname = b;
//     lastname = c;
//     position = d;
//     number_of_day_worked = e;
//    }

  

}


```

{% hint style="success" %}
The values passed in the parameterised constructor are assigned to the instance variables.

So, Parameterised constructor creates the object and also sets the instance variables
{% endhint %}

![](https://1972396024-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MCuqiBdVbVkT07RwbQD%2F-MDVtc6eSaPgobrE6oJ-%2F-MDVtzIdS6EM3HKgMhMK%2Fdiagram-20200731.svg?alt=media\&token=68f38192-6fd2-408a-bca5-6d19a6c440a7)

{% hint style="danger" %}
You can't use default constructor and parameterised constructor in the same class definition .&#x20;
{% endhint %}
