class Mobile {
public static brand: string = 'OPPO';
protected static model: string = 'A85';
private static price: number = 15500;
constructor(mobileBrand: string, mobileModel: string, mobilePrice: number) {
Mobile.brand = mobileBrand;
Mobile.model = mobileModel;
Mobile.price = mobilePrice;
}
private static getData(): string {
//Can not access outside of class, accessible within class
return `${Mobile.brand} ${Mobile.model} ${Mobile.price}`;
}
public static getter(): string {
return ${Mobile.getData()};
}
protected static showModileInfo(): string {
//Can not access outside of class , accessible within class or exteded classs
return `${this.brand} ${this.model} ${this.price}`;
}
public static showData(brand: string, model: string, price: number): string {
return `${this.getData()}\n${brand} ${model} ${price}`;
}
public static showStaticPropsData(
brand: string,
model: string,
price: number
): string {
return `${brand} ${model} ${price}`;
}
}
// const mobObj = new Mobile('Nokia', 'N85 5GB', 16500);
// console.log(mobObj);
console.log((Mobile.brand = 'Motorolla GX750'));
// console.log(Mobile.model); //Can not access outside of class , accessible within class or exteded classs
// const result = Mobile.showData('Apple', '15Pro', 18000);
// console.log(result);
const re = Mobile.getter();
console.log(re);