inheritance1 Dart Inheritance & override 이해하기 Dart의 상속에 대해서 이해해보겠습니다. 먼저 Human Class를 생성합니다. Human 클래스는 이름과 나이를 나타내는 멤버 변수로 가지고 있습니다. class Human { String name; int age; Human({ required this.name, required this.age, }); void intro() { print("My name is $name and I'm $age years old."); } } 다음은 Human 클래스를 상속받은 Student 클래스를 생성합니다. Student 클래스는 학생ID를 나타내는 number 라는 멤버 변수를 하나 더 가지고 있습니다. class Student extends Human { final int number; Student({.. 2023. 1. 6. 이전 1 다음