class car {
constructor() {}
name = "Infiniti";
model = "FX_35";
}
const machine = new car();
//console.log(
machine.name, machine.model);
class helm { // helm
constructor(diameter) {
this.diameter = diameter;
this.a = new car();
}
set maxDiameter(diameter) {
this.diameter = diameter;
}
get maxDiameter() {
return this.diameter * 3;
}
}
//var h = new helm(50);
//console.log(h.maxDiameter);
car.prototype.someMethod = function(){
console.log(
machine.name, machine.model);
}
helm.prototype.someMethod = function(){ //////////
this.a.someMethod();
}
var c = new helm();
c.someMethod();
class wheel { // wheel
constructor(width) {
this.width = width;
}
set maxWidth(width) {
this.width = width;
}
get maxWidth() {
return this.width * 5;
}
}
var w = new wheel(25);
console.log(w.maxWidth);
class body { // body
constructor(size) {
this.size = size;
}
set maxSize(size) {
this.size = size;
}
get maxSize() {
return this.size * 4;
}
}
var b = new body(100);
console.log(b.maxSize);