Skip to content

Commit

Permalink
Add pure virtual test
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Jan 15, 2024
1 parent 382b35e commit cbb1e72
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/src/example.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,22 @@ class ExampleAbstract : public Object {
static void _bind_methods() {}
};

class ExamplePureVirtualBase : public Object {
GDCLASS(ExamplePureVirtualBase, Object);

protected:
static void _bind_methods() {}

virtual int test_function() = 0;
};

class ExamplePureVirtual : public ExamplePureVirtualBase {
GDCLASS(ExamplePureVirtual, ExamplePureVirtualBase);

protected:
static void _bind_methods() {}

int test_function() override { return 25; }
};

#endif // EXAMPLE_CLASS_H
3 changes: 3 additions & 0 deletions test/src/register_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ void initialize_example_module(ModuleInitializationLevel p_level) {
ClassDB::register_class<Example>();
ClassDB::register_class<ExampleVirtual>(true);
ClassDB::register_abstract_class<ExampleAbstract>();

GDREGISTER_VIRTUAL_CLASS(ExamplePureVirtualBase);
GDREGISTER_CLASS(ExamplePureVirtual);
}

void uninitialize_example_module(ModuleInitializationLevel p_level) {
Expand Down

0 comments on commit cbb1e72

Please sign in to comment.