Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lyuma opened this issue Dec 7, 2022 · 0 comments

Comments

@lyuma
Copy link
Contributor

lyuma commented Dec 7, 2022

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

@lyuma lyuma added this to the 4.0 milestone Dec 7, 2022
@akien-mga akien-mga modified the milestones: 4.0, 4.1 Feb 27, 2023
@YuriSizov YuriSizov modified the milestones: 4.1, 4.2 Jun 22, 2023
@YuriSizov YuriSizov modified the milestones: 4.2, 4.x Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants