🔗 Access the Source Code: thapatechnical.shop/source-code 📚 Complete Code and Resources: thapatechnical.shop/courses/typescript-crash-course
@editor999official
2 ай бұрын
12:21 Line 53 mein aapko color.displayArea; //aese nhi likhna hai color.displayArea(); //aese likhna hai, warna line 46 main displayArea wala function waste hojaega. Btw you are the best teacher, Thankyou so much to teach us for free
@Daily_dose_motivation29
Жыл бұрын
😊😊
@vivekbhardwaj3964
Жыл бұрын
Great session
@nityaranjan6714
7 ай бұрын
Why we write circle.displayArea ? displayArea is a function, so it should be writen as circle.displayArea() right?
@AkashKumar-kg7ge
Жыл бұрын
❤
@VivekYadav-up7uu
Жыл бұрын
can you make a playlist on react native
@mailtodanish
7 ай бұрын
declare abstract class ?
@saurabhkamble3211
8 ай бұрын
Area of Rectangle and Square using Getter and Setter Method //Area of Square class ArSq{ private _side:number | undefined; constructor( public name: string, public color:string, ) { } public set side(side:number){ if(side < 0){ throw new Error("Invalid Input") } this._side=side; } public get side(){ if(this._side==undefined){ throw new Error("It is undefoned") } return this._side ** 2; } info():string{ return `` } } // Area of Rectangle class Rectangle { private length: number; private width: number; constructor(length: number, width: number) { this.length = length; this.width = width; } // getter method for length get Length(): number { return this.length; } // setter method for length set Length(value: number) { if (value < 0) { throw new Error("Length cannot be negative."); } this.length = value; } // getter method for width get Width(): number { return this.width; } // setter method for width set Width(value: number) { if (value < 0) { throw new Error("Width cannot be negative."); } this.width = value; } // method to calculate area calculateArea(): number { return this.length * this.width; } } class squ1 extends ArSq{ } const rectangle = new Rectangle(10,50); const Ars:ArSq = new squ1("Square","Red") console.log(`Area of rectangle: ${rectangle.calculateArea()}`); // change the length and width rectangle.Length = 20; rectangle.Width = 10; console.log(`Area of rectangle after changing length and width: ${rectangle.calculateArea()}`); Ars.side = 50; console.log("The Area of Square: ",Ars.side)
Пікірлер: 9