Default Constructor In Dart - Learn Dart Programming

preview_player
Показать описание
This video covers information about default constructor in dart. You will learn how to create default constructor with different examples.

Connect With Me:

#Dart #Constructor #DartConstructor #DefaultConstructor #LearnDart
Рекомендации по теме
Комментарии
Автор

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

rulesmen
Автор

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

chukukapeter
Автор

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

gu
Автор

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.

sakibraza-py
Автор

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}");
}

ThiruvikramanJ