Skip to content

OpenXRExtensionWrapperExtension: Avoid use of multiple inheritance with data members #69694

Open
@lyuma

Description

@lyuma

Godot version

v4.0.beta7

System information

All

Issue description

I'm concerned about the use of Multiple Inheritance with class OpenXRExtensionWrapperExtension : public Object, OpenXRExtensionWrapper given that OpenXRExtensionWrapper has member variables

one of the principles I've usually followed is to avoid MI in c++ unless all but the first parent have no members
In this case, OpenXRExtensionWrapper defines

        OpenXRAPI *openxr_api = nullptr;
        HashMap<String, bool *> request_extensions;

it's such a small amount of data that I think these belong in each of the child classes, and those should be the ones to implement the get_request_extensions() function and the constructor
That way, OpenXRExtensionWrapper can be a class with only virtual functions. perhaps get_request_extensions() can be declared pure virtual so implementers are forced to store the request_extensions

Originally posted by @lyuma in #68259 (comment)

Steps to reproduce

Code quality issue. Look for classes which have multiple inheritance (class.*:.*,)

Minimal reproduction project

N/A

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions