Last active
January 29, 2024 02:56
-
-
Save doyle-flutter/a33c7650b99bea2f953f4fef179474a8 to your computer and use it in GitHub Desktop.
class01 abstract
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(){ | |
// new OnlyTemplete(); // err -> only class | |
OnlyTemplete obj1 = Obj1(); | |
obj1.func(); | |
obj1.func2(); | |
obj1.func3(); | |
// obj1.func4(); // err -> only obj1 | |
OnlyTemplete obj2 = Obj1(); | |
obj2.func(); | |
obj2.func2(); | |
obj2.func3(); | |
// obj2.func4(); // err -> only obj1 | |
// obj2.func5(); // err -> only obj2 | |
} | |
abstract class OnlyTemplete{ | |
void func(); | |
void func2() => print("temp"); | |
void func3() => print("temp temp"); | |
} | |
class Obj1 extends OnlyTemplete{ | |
void func() => print("obj1"); | |
@override | |
void func3() => print("temp - obj1"); | |
void func4() => print("only obj4"); | |
} | |
class Obj2 implements OnlyTemplete{ | |
void func() => print("obj2"); | |
@override | |
void func2() => print("tmep - obj2"); | |
@override | |
void func3() => print("temp - obj2"); | |
void func5() => print("only obj2"); | |
} | |
/// --------------------------------------------------------------- | |
abstract class OnlyTemplete2{ | |
void func6(); | |
} | |
// class Obj3 extends OnlyTemplete OnlyTemplete2 {} // err -> only 1 | |
class Obj3 extends OnlyTemplete implements OnlyTemplete2{ | |
@override | |
void func() {} | |
@override | |
void func6() {} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment