// ********** First Approach 
class MyCarComponent {
    private car: object = { };
    constructor(){
        this.car['name'] = "AudI";
        this.car['model'] = "2017";
    }
}
// *********** 2nd Approach 
class Car {
    name: string;
    model: string;
}
class MyCarrComponent {
    private car: Car = new Car();
    constructor(){
        this.car.name = "AudI";
        this.car.model = "2017";
    }
}
Please comment for correct approach
              
    
Top comments (0)