Default Constructor In Dart - Learn Dart Programming

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

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

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

    Thank you for the simple explanation. Wish you all the best!! 👍

  • @niwemugenifabiola2783
    @niwemugenifabiola2783 2 месяца назад

    Good teacher ever

  • @MrAngeloDy
    @MrAngeloDy 2 месяца назад

    Man you're awesome!
    Thanx

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

    brooooo, you are good, you may not see this comment but thanks alot.

  • @sakibraza-p6y
    @sakibraza-p6y 4 месяца назад

    class person {
    // PROPERTIES
    String? name;
    String? planet;
    // DEFAULT CONSTRUCTOR
    person () {
    this.planet = 'EARTH';
    }
    main () {
    person p =person ();
    p.name = 'sakib kadri';
    print (p.name);
    print(p.planet);
    }
    OUTPUT IS:
    SAKIB KADRI
    EARTH ->YAHA PAR EARTH EK DEFAULT CONSTRUCTOR HE.

  • @abdurrehmanch27
    @abdurrehmanch27 2 года назад

    🥰🥰🥰

  • @gu3874
    @gu3874 5 месяцев назад

    i will never understand why would someone use 3 of the same name for different things.. Why wouldnt you name the class gadgets, object laptop, and constructor something else

    • @zionof37
      @zionof37 2 месяца назад +1

      The class and constructor name must be the same ,thats the rule but u can use differentt name for the object😊

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

    class Person {
    String? name;
    String? planet;
    Person(){
    this.planet = "Earth";
    }
    }
    void main() {
    Person p1 = Person();
    p1.name = "Raj";
    //p1.planet = "Saturn";
    print("The person named ${p1.name} is from the planet ${p1.planet}");
    Person p2 = Person();
    p2.name = "Ram";
    print("The person named ${p2.name} is also from the planet ${p2.planet}");
    }