var Person = function(firstname) {
    if (!(this instanceof Person)) {
        throw new Error("Person jest konstruktorem");
    }
    this.firstname = firstname;
};

Person.prototype.giveBirth = function() {
    // ...rodzi się osoba
};

var Employee = function(firstname, lastname, job) {
    if (!(this instanceof Employee)) {
        throw new Error("Employee jest konstruktorem");
    }
    Person.call(this, firstname);
    this.job = job;
};
Employee.prototype = Object.create(Person.prototype);
Employee.prototype.constructor = Employee;
Employee.prototype.startJob = function() {
    // ...pracownik podejmuje pracę
};

var Engineer = function(firstname, lastname, job, department) {
    if (!(this instanceof Engineer)) {
        throw new Error("Engineer jest konstruktorem");
    }
    Employee.call(this, firstname, lastname, job);
    this.department = department;
};
Engineer.prototype = Object.create(Employee.prototype);
Engineer.prototype.constructor = Engineer;
Engineer.prototype.startWorking = function() {
    // ...inżynier zaczyna pracować
};

---

class Person {
    constructor(firstname) {
        this.firsnamet = firstname;
    }
    giveBirth() {
        // ...rodzi się osoba
    }
}

class Employee extends Person {
    constructor(firstname, lastname, job) {
        super(firstname);
        this.lastname = lastname;
        this.position = position;
    }

    startJob() {
        // ...pracownik podejmuje pracę
    }
}

class Engineer extends Employee {
    constructor(firstname, lastname, job, department) {
        super(firstname, lastname, job);
        this.department = department;
    }

    startWorking() {
        // ...inżynier zaczyna pracować
    }
}

---

const NamedCar = class Car{
  constructor(model, year){
    this.model = model;
    this.year = year;
  }
  getName() {
    return Car.name;
  }
}
const ford = new NamedCar();
console.log(ford.getName()); 
console.log(ford.name);      

---
class Car {
  constructor(model, year){
    this.model = model;
    this.year = year;
  }
}
const fiesta = new Car('Fiesta','2010');
---

class Car {
  constructor(model, year){
    this.model = model;
    this.year = year;
  }
  get model(){
    return this.model
  }
  calculateCurrentValue(){
    return "7000"
  }
}
const fiesta = new Car('Fiesta','2010')
console.log(fiesta.model)

---

class CarOne {
    driveCar() {}
}
class CarTwo {
    ['drive'+'Car']() {}
}
const methodName = 'driveCar';
class CarThree {
    [methodName]() {}
}

---

class iterableArg {
    constructor(...args) {
        this.args = args;
    }
    * [Symbol.iterator]() {
        for (const arg of this.args) {
            yield arg;
        }
    }
}

for (const x of new iterableArg('ES6', 'wygrywa')) {
    console.log(x);
}

---

class Animal {
  constructor(name) {
    this.name = name;
  }
    speak() {
    console.log(this.name + ' wydawany dźwięk');
  }
}
class Cat extends Animal {
  speak() {
    console.log(this.name + ' robi miau.');
  }
}
var c = new Cat('Pusia');
c.speak();

---

class Animal {
  constructor(name) {
    this.name = name;
  }
  speak() {
    console.log(this.name + ' wydawany dźwięk');
  }
}
class Cat extends Animal {
  speak() {
    console.log(this.name + ' robi miau.');
  }
}
class Lion extends Cat {
  speak() {
    super.speak();
    console.log(this.name + ' ryczy...');
  }
}
var l = new Lion('Simba');
l.speak();
---

class Person {}
const BackgroundCheck = Tools => class extends Tools {
  check() {}
};
const Onboard = Tools => class extends Tools {
  printBadge() {}
};
class Employee extends BackgroundCheck(Onboard(Person)){
}

---

//----------------server.js---------------------
export const port = 8080;
export function startServer() {
  //...uruchamia serwer
}
export class Config {
  //...
}
function processConfig() {
  //...
}

---

export {port, startServer, Config};
const port = 8080;
function startServer() {
  //...uruchamia serwer
}
class Config {
  //...
}
function processConfig() {
  //...
}

---


