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

Поделиться
HTML-код
  • Опубликовано: 2 дек 2024

Комментарии • 9

  • @ThapaTechnical
    @ThapaTechnical  Год назад

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

  • @editor999official
    @editor999official 4 месяца назад

    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 10 месяцев назад

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

  • @vivekbhardwaj3964
    @vivekbhardwaj3964 Год назад

    Great session

  • @Radhe_radhe2929
    @Radhe_radhe2929 Год назад +1

    😊😊

  • @VivekYadav-up7uu
    @VivekYadav-up7uu Год назад

    can you make a playlist on react native

  • @saurabhkamble3211
    @saurabhkamble3211 11 месяцев назад

    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)

  • @AkashKumar-kg7ge
    @AkashKumar-kg7ge Год назад