mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
GDScript: Add abstract methods
Co-authored-by: ryanabx <ryanbrue@hotmail.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
abstract class AbstractClass:
|
||||
abstract func some_func()
|
||||
|
||||
class ImplementedClass extends AbstractClass:
|
||||
func some_func():
|
||||
pass
|
||||
|
||||
abstract class AbstractClassAgain extends ImplementedClass:
|
||||
abstract func some_func()
|
||||
|
||||
class Test1:
|
||||
abstract func some_func()
|
||||
|
||||
class Test2 extends AbstractClass:
|
||||
pass
|
||||
|
||||
class Test3 extends AbstractClassAgain:
|
||||
pass
|
||||
|
||||
class Test4 extends AbstractClass:
|
||||
func some_func():
|
||||
super()
|
||||
|
||||
func other_func():
|
||||
super.some_func()
|
||||
|
||||
func test():
|
||||
pass
|
||||
@@ -0,0 +1,6 @@
|
||||
GDTEST_ANALYZER_ERROR
|
||||
>> ERROR at line 11: Class "Test1" is not abstract but contains abstract methods. Mark the class as abstract or remove "abstract" from all methods in this class.
|
||||
>> ERROR at line 14: Class "Test2" must implement "AbstractClass.some_func()" and other inherited abstract methods or be marked as abstract.
|
||||
>> ERROR at line 17: Class "Test3" must implement "AbstractClassAgain.some_func()" and other inherited abstract methods or be marked as abstract.
|
||||
>> ERROR at line 22: Cannot call the parent class' abstract function "some_func()" because it hasn't been defined.
|
||||
>> ERROR at line 25: Cannot call the parent class' abstract function "some_func()" because it hasn't been defined.
|
||||
Reference in New Issue
Block a user