Constructor In Dart - Learn Dart Programming

Поділитися
Вставка
  • Опубліковано 20 гру 2024

КОМЕНТАРІ • 22

  • @kopihannan3226
    @kopihannan3226 3 місяці тому +2

    Bro please create flutter tutorial ❤

  • @jaydobariya8
    @jaydobariya8 8 місяців тому +1

    class Patient{
    String? name;
    int? age;

    Patient(this.name,this.age);
    }
    void main() {
    Patient p = Patient("jay",21);
    print(p.name);
    print(p.age);
    }

  • @raghav042
    @raghav042 8 місяців тому

    Very helpful series ❤

  • @BankITOfficer
    @BankITOfficer Рік тому +2

    class Patient {
    String? name;
    int? age;
    String? disease;
    Patient(String name, int age, String disease) {
    this.name = name;
    this.age = age;
    this.disease = disease;
    }
    void display() {
    print("Name is $name");
    print("age is $age");
    print("Disease is $disease");
    }
    }
    void main(List args) {
    Patient patient = Patient("vikram", 33, "typhoid");
    patient.display();
    }

  • @Кыргызстан-менинмекеним

    you are really handsome in this video, keep up the good work.

  • @StefenTjung
    @StefenTjung 4 місяці тому

    i dont understand why should we use constructor? i mean if you didnt put the constructor, i still works way the same right? just change the void display to
    void display (){
    print ("Name is $name");
    print ("Age is $age");
    }

  • @viandaelendherlina5923
    @viandaelendherlina5923 2 роки тому

    thanks for your challengge

  • @becborahm
    @becborahm Рік тому

    🤔It's a bit difficult for me. I will watch all your video and come back to this video again. 😅😁 Thank you!!

  • @MuhammadMohsinHussain-sz6no
    @MuhammadMohsinHussain-sz6no 9 місяців тому

    You are Awesome

  • @omarmoahmed9992
    @omarmoahmed9992 Рік тому

    Thanks bro

  • @Achchabl6377
    @Achchabl6377 Рік тому

    class Patient {
    String? name;
    int? age;
    String? disease;
    Patient(String name, int age, String disease) {
    this.name = name;
    this.age = age;
    this.disease = disease;
    }
    }
    void main() {
    Patient patient = Patient("Harry", 23, "flue");
    print(patient.name);
    print(patient.age);
    print(patient.disease);
    }

  • @khubaibirfan9215
    @khubaibirfan9215 2 роки тому

    ❤️❤️❤️💓💓❤️💓❤️

  • @Lui_Catarino
    @Lui_Catarino 8 місяців тому

    class Patient {
    String? name;
    int? age;
    String? disease;
    Patient(this.name, this.age, this.disease);

    void display(){
    print( 'Name: $name');
    print('Age: $age');
    print('Disease: $disease');
    }
    }
    void main(){
    Patient pacient= Patient('Lui', 19, 'Sobrepreso');
    pacient.display();
    }

  • @born2learn507
    @born2learn507 11 місяців тому

    class Patient {
    String? name;
    int? age;
    String? disease;
    //creating constructor
    Patient(n, a, d) {
    this.name = n;
    this.age = a;
    this.disease = d;
    }
    }
    void main() {
    Patient patient = Patient("Ram", 33, "Cancer");
    print(patient.name);
    print(patient.age);
    print(patient.disease);
    }

  • @zionof37
    @zionof37 2 місяці тому

    class Patient {
    String? name;
    int? age;
    String? disease;
    Patient(this.name, this.age,this.disease);
    void display(){
    print("The patient name is ${this.name}");
    print("The patient age is ${this.age}");
    print("The patient disease is ${this.disease}");
    }
    }
    void main() {
    Patient p = Patient("Abebe",30,"Ameba");
    p.display();
    }

  • @StefenTjung
    @StefenTjung 4 місяці тому

    Class Patient (){
    String? name;
    int? age;
    String? disease;
    Patient ({this.name, this.age,this.disease});
    void print (){
    print("Name: ${this.name} ;
    print("Name: ${this.age} ;
    print("Name: ${this.disease} ;
    }
    }
    void main () {
    Patient p1 = Person("Wooble", 10, "Stomatche")
    p1.display();
    }

  • @ibrahimcetin5034
    @ibrahimcetin5034 7 місяців тому

    patient.dart
    class Patient {
    String? name;
    int? age;
    String? illness;
    Patient({required this.name, required this.age, required this.illness}) {}
    void display() {
    print("patient name is ${this.name}");
    print("patient age is ${this.age}");
    print("patient illness is ${this.illness}");
    }
    }
    main.dart
    import 'patient.dart';
    void main() {
    Patient p1 = Patient(name: "Ibrahim", age: 21, illness: "grip");
    p1.display();
    }