> 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/inheritance/parent-class-and-child-class.md).

# Inheritance, Types of Inheritance , Terminology

## Basic concept of Inheritance&#x20;

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

{% hint style="success" %}
You can inherit all the properties and methods of a class by using "extends" keyword
{% endhint %}

## Types of Inheritance & Terminology&#x20;

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

{% hint style="warning" %}
Dart doesn't support multiple inheritance  .If you want to know why,  Google "Deadly Diamond of Death"&#x20;
{% endhint %}

## Coding Example&#x20;

{% embed url="<https://youtu.be/0J5X4e-wD7c>" %}

```dart
void main() {
  // Inheritance Example

  var developer1 = Developer();

  var manager1 = Manager();
  

  developer1.id = 1;

  developer1.firstname = "John";

  developer1.lastname = "Doe";

  developer1.dayworked = 12;
  
  
  
  developer1.proglanguage = "Dart";
  
  
  

  manager1.id = 2;

  manager1.firstname = "Jane";

  manager1.lastname = "Doe";

  manager1.dayworked = 12;
  
  
  
  manager1.project = "Alpha";
  

  print(developer1.id);
  print(developer1.firstname);
  print(developer1.lastname);
  print(developer1.dayworked);
  print(developer1.fullname());
  print(developer1.salary(20));
  
  print(developer1.coding());

  print("------------");

  print(manager1.id);
  print(manager1.firstname);
  print(manager1.lastname);
  print(manager1.dayworked);
  print(manager1.fullname());
  print(manager1.salary(20));
  
  
  print(manager1.manageproject());
  
  
  
}

class Employee {
  int id;
  int dayworked;
  String firstname;
  String lastname;

  String fullname() {
    return this.firstname + " " + this.lastname;
  }

  int salary(int perDaywage) {
    return (this.dayworked * perDaywage);
  }
}





// Developer Class 


class Developer extends Employee {
  
  //property 
  
  String proglanguage;
  
  
 // Method 

  String coding() {
    return "Coding in " + " " + this.proglanguage;
  }
}




// Manager Class 


class Manager extends Employee {
  
  
  //property 
   String project;
  
  
  
  //Method 
  
  String manageproject(){
    
    return "Managing project " + " " + this.project;
    
    
    
  }
  
  
  
  
  
}


```

{% tabs %}
{% tab title="Introduction to Inheritance " %}
![](https://1972396024-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MCuqiBdVbVkT07RwbQD%2F-MDlvXGE0Iyk6IuZNtVt%2F-MDlvaINq1HkQVeXREIs%2F1.svg?alt=media\&token=d77dc644-895d-4e7a-845f-4e52bc76c4ad)
{% endtab %}

{% tab title="Types of Inheritance " %}
![](https://1972396024-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MCuqiBdVbVkT07RwbQD%2F-MDlvd3dsDTKvBhjUzKt%2F-MDlvn00CeOo-sDU-j2v%2F2.svg?alt=media\&token=4de98fbf-58fc-4b4e-8dc1-6e3e3e7bb76d)
{% endtab %}

{% tab title="Terminology" %}
![](https://1972396024-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MCuqiBdVbVkT07RwbQD%2F-MDlvus7vgdTtBY2xxii%2F-MDlvx3q4Nc2KV8BJwFN%2F3.svg?alt=media\&token=40ee6561-07fb-4095-b33f-20656c445f30)
{% endtab %}

{% tab title="Coding Example" %}
![](https://1972396024-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MCuqiBdVbVkT07RwbQD%2F-MDlw73fU3t3K7VRJwci%2F-MDlw9KCpcyG8tuZpquF%2F4.svg?alt=media\&token=22f32c93-6a70-4d38-8884-00b4dc653460)
{% endtab %}
{% endtabs %}

> Note: There is a typo . Used "manager1.dayworked = 12"  instead of &#x20;
>
> > "manager1.dayworked = 10"&#x20;
