class Car {
public name: string = '';
protected price: number = 0;
private model: string = '';
constructor(name: string, price: number, model: string) {
this.name = name;
this.price = price;
this.model = model;
}
public display(): string {
return `${this.name} ${this.price}, ${this.model}`;
}
}
const carObj = new Car('BMW', 15000000, 'X7');
console.log(carObj.display());