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

Why are helpers defined with abstract + final #2

Open
Cytotropist opened this issue Feb 21, 2024 · 1 comment
Open

Why are helpers defined with abstract + final #2

Cytotropist opened this issue Feb 21, 2024 · 1 comment

Comments

@Cytotropist
Copy link

Cytotropist commented Feb 21, 2024

I've noticed almost all helpers in WTLHelper are defined like:

struct SomeHelper abstract final 
{
    static bool StaticMethod();
};

My current understanding is that this behaves just like a namespace right? I mean, we can't really instantiate (abstract) nor derive(final) from these helpers. I'm just curious why was this pattern chosen instead of a namespace? Regardless, I'm enjoying using this since I got started with WTL so thank you

@zodiacon
Copy link
Owner

"abstract final" means that no instance could be created and no class could be derived. The class just provides a bunch of static helpers. It's similar to putting them in a namespace. However, with a namespace you can use "using namespace foo" to gain access without the namespace name, which you cannot do with a class/struct. That's why I prefer it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants