#30: Abstract Classes in TypeScript in Hindi 👉 with Real-life Examples

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ต.ค. 2024

ความคิดเห็น • 9

  • @ThapaTechnical
    @ThapaTechnical  ปีที่แล้ว

    🔗 Access the Source Code: thapatechnical.shop/source-code
    📚 Complete Code and Resources: thapatechnical.shop/courses/typescript-crash-course

  • @editor999official
    @editor999official 3 หลายเดือนก่อน

    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

  • @nityaranjan6714
    @nityaranjan6714 9 หลายเดือนก่อน

    Why we write circle.displayArea ? displayArea is a function, so it should be writen as circle.displayArea() right?

  • @vivekbhardwaj3964
    @vivekbhardwaj3964 ปีที่แล้ว

    Great session

  • @VivekYadav-up7uu
    @VivekYadav-up7uu ปีที่แล้ว

    can you make a playlist on react native

  • @Radhe_radhe2929
    @Radhe_radhe2929 ปีที่แล้ว +1

    😊😊

  • @AkashKumar-kg7ge
    @AkashKumar-kg7ge ปีที่แล้ว

  • @saurabhkamble3211
    @saurabhkamble3211 9 หลายเดือนก่อน

    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)