Difference between class and struct in with regards to padding and inheritanceWhy is there not an std::is_struct type trait?Adding a default constructor to a base class changes sizeof() a derived typeWhat is the difference between #include <filename> and #include “filename”?When should you use a class vs a struct in C++?What are the differences between a pointer variable and a reference variable in C++?What are the differences between struct and class in C++?What is the difference between g++ and gcc?Difference between 'struct' and 'typedef struct' in C++?Difference between private, public, and protected inheritanceWhat is the difference between const int*, const int * const, and int const *?What is the difference between 'typedef' and 'using' in C++11?Difference between `constexpr` and `const`
Why didn't Doctor Strange restore Tony Stark after he used the Stones?
Will the internet speed decrease on second router if there are multiple devices connected to primary router?
Why did my "seldom" get corrected?
How to interpret a promising preprint that was never published in peer-review?
Is this Android phone Android 9.0 or Android 6.0?
How do I reproduce this layout and typography?
Which GPUs to get for Mathematical Optimization (if any)?
Don't individual signal sources affect each other when using a summing amplifier?
Apex Legends stuck at 60 FPS (G-Sync 144hz monitor)
Difference between class and struct in with regards to padding and inheritance
Should I have one hand on the throttle during engine ignition?
Diagram of Methods to Solve Differential Equations
Can error correction and detection be done without adding extra bits?
Should I have shared a document with a former employee?
Can I use a 3 pin kettle power lead instead of a 2 pin kettle power lead
Why are there few or no black super GMs?
How do you send money when you're not sure it's not a scam?
Is encryption still applied if you ignore the SSL certificate warning for self-signed certs?
Manager asking me to eat breakfast from now on
How to tell readers that I know my story is factually incorrect?
Left crank keeps coming loose
Operation Unzalgo
Who determines when road center lines are solid or dashed?
literal `0` beeing a valid candidate for int and const string& overloads causes ambiguous call
Difference between class and struct in with regards to padding and inheritance
Why is there not an std::is_struct type trait?Adding a default constructor to a base class changes sizeof() a derived typeWhat is the difference between #include <filename> and #include “filename”?When should you use a class vs a struct in C++?What are the differences between a pointer variable and a reference variable in C++?What are the differences between struct and class in C++?What is the difference between g++ and gcc?Difference between 'struct' and 'typedef struct' in C++?Difference between private, public, and protected inheritanceWhat is the difference between const int*, const int * const, and int const *?What is the difference between 'typedef' and 'using' in C++11?Difference between `constexpr` and `const`
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
All of the below will be done on GCC 9.1 using godbolt, in x86-64, using -O3.
I have this code:
struct Base
Base()
double foo;
int bar;
;
struct Derived : public Base
int baz;
;
int main(int argc, char** argv)
return sizeof(Derived);
https://godbolt.org/z/OjSCZB
It correctly returns 16, as I would expect, 8 bytes for foo, and 4 bytes for bar and 4 bytes for baz. This works only because Derived inherits from Base and so it does not have to pad after bar due to Derived being a single type containing both Base and Derived elements.
I have 2 questions, as below:
First question
If I remove the explicit constructor of Base() , it starts returning 24, instead of 16. i.e. it adds padding after bar and baz.
https://godbolt.org/z/0gaN5h
I can't explain why having an explicit default constructor is any different to having an implicit default constructor.
Second question
If I then change struct to class for Base, it changes back to returning 16, I can not explain this either. Why would the access modifiers change the size of the structure?
https://godbolt.org/z/SCYKwL
c++ c++11 gcc
|
show 5 more comments
All of the below will be done on GCC 9.1 using godbolt, in x86-64, using -O3.
I have this code:
struct Base
Base()
double foo;
int bar;
;
struct Derived : public Base
int baz;
;
int main(int argc, char** argv)
return sizeof(Derived);
https://godbolt.org/z/OjSCZB
It correctly returns 16, as I would expect, 8 bytes for foo, and 4 bytes for bar and 4 bytes for baz. This works only because Derived inherits from Base and so it does not have to pad after bar due to Derived being a single type containing both Base and Derived elements.
I have 2 questions, as below:
First question
If I remove the explicit constructor of Base() , it starts returning 24, instead of 16. i.e. it adds padding after bar and baz.
https://godbolt.org/z/0gaN5h
I can't explain why having an explicit default constructor is any different to having an implicit default constructor.
Second question
If I then change struct to class for Base, it changes back to returning 16, I can not explain this either. Why would the access modifiers change the size of the structure?
https://godbolt.org/z/SCYKwL
c++ c++11 gcc
2
Half a dupe of stackoverflow.com/q/47914612/560648. I don't know why changing the keyword introducing the base would make a difference though (given that there's no member re-ordering going on anyway so differing member access levels oughtn't come into it)
– Lightness Races in Orbit
8 hours ago
Ah thanks! That answer the first question, but not the second
– Salgar
8 hours ago
2
Re: "It correctly returns 16, as I would expect" -- by definition, the result ofsizeofis correct, regardless of what you expect.
– Pete Becker
8 hours ago
Hmm yeah it's the access specifier; addpublic:.
– Lightness Races in Orbit
8 hours ago
@LightnessRacesinOrbit not a bug. Aggregates can't have private members
– NathanOliver
8 hours ago
|
show 5 more comments
All of the below will be done on GCC 9.1 using godbolt, in x86-64, using -O3.
I have this code:
struct Base
Base()
double foo;
int bar;
;
struct Derived : public Base
int baz;
;
int main(int argc, char** argv)
return sizeof(Derived);
https://godbolt.org/z/OjSCZB
It correctly returns 16, as I would expect, 8 bytes for foo, and 4 bytes for bar and 4 bytes for baz. This works only because Derived inherits from Base and so it does not have to pad after bar due to Derived being a single type containing both Base and Derived elements.
I have 2 questions, as below:
First question
If I remove the explicit constructor of Base() , it starts returning 24, instead of 16. i.e. it adds padding after bar and baz.
https://godbolt.org/z/0gaN5h
I can't explain why having an explicit default constructor is any different to having an implicit default constructor.
Second question
If I then change struct to class for Base, it changes back to returning 16, I can not explain this either. Why would the access modifiers change the size of the structure?
https://godbolt.org/z/SCYKwL
c++ c++11 gcc
All of the below will be done on GCC 9.1 using godbolt, in x86-64, using -O3.
I have this code:
struct Base
Base()
double foo;
int bar;
;
struct Derived : public Base
int baz;
;
int main(int argc, char** argv)
return sizeof(Derived);
https://godbolt.org/z/OjSCZB
It correctly returns 16, as I would expect, 8 bytes for foo, and 4 bytes for bar and 4 bytes for baz. This works only because Derived inherits from Base and so it does not have to pad after bar due to Derived being a single type containing both Base and Derived elements.
I have 2 questions, as below:
First question
If I remove the explicit constructor of Base() , it starts returning 24, instead of 16. i.e. it adds padding after bar and baz.
https://godbolt.org/z/0gaN5h
I can't explain why having an explicit default constructor is any different to having an implicit default constructor.
Second question
If I then change struct to class for Base, it changes back to returning 16, I can not explain this either. Why would the access modifiers change the size of the structure?
https://godbolt.org/z/SCYKwL
c++ c++11 gcc
c++ c++11 gcc
edited 8 hours ago
Lightness Races in Orbit
308k57 gold badges508 silver badges852 bronze badges
308k57 gold badges508 silver badges852 bronze badges
asked 8 hours ago
SalgarSalgar
6,1891 gold badge21 silver badges35 bronze badges
6,1891 gold badge21 silver badges35 bronze badges
2
Half a dupe of stackoverflow.com/q/47914612/560648. I don't know why changing the keyword introducing the base would make a difference though (given that there's no member re-ordering going on anyway so differing member access levels oughtn't come into it)
– Lightness Races in Orbit
8 hours ago
Ah thanks! That answer the first question, but not the second
– Salgar
8 hours ago
2
Re: "It correctly returns 16, as I would expect" -- by definition, the result ofsizeofis correct, regardless of what you expect.
– Pete Becker
8 hours ago
Hmm yeah it's the access specifier; addpublic:.
– Lightness Races in Orbit
8 hours ago
@LightnessRacesinOrbit not a bug. Aggregates can't have private members
– NathanOliver
8 hours ago
|
show 5 more comments
2
Half a dupe of stackoverflow.com/q/47914612/560648. I don't know why changing the keyword introducing the base would make a difference though (given that there's no member re-ordering going on anyway so differing member access levels oughtn't come into it)
– Lightness Races in Orbit
8 hours ago
Ah thanks! That answer the first question, but not the second
– Salgar
8 hours ago
2
Re: "It correctly returns 16, as I would expect" -- by definition, the result ofsizeofis correct, regardless of what you expect.
– Pete Becker
8 hours ago
Hmm yeah it's the access specifier; addpublic:.
– Lightness Races in Orbit
8 hours ago
@LightnessRacesinOrbit not a bug. Aggregates can't have private members
– NathanOliver
8 hours ago
2
2
Half a dupe of stackoverflow.com/q/47914612/560648. I don't know why changing the keyword introducing the base would make a difference though (given that there's no member re-ordering going on anyway so differing member access levels oughtn't come into it)
– Lightness Races in Orbit
8 hours ago
Half a dupe of stackoverflow.com/q/47914612/560648. I don't know why changing the keyword introducing the base would make a difference though (given that there's no member re-ordering going on anyway so differing member access levels oughtn't come into it)
– Lightness Races in Orbit
8 hours ago
Ah thanks! That answer the first question, but not the second
– Salgar
8 hours ago
Ah thanks! That answer the first question, but not the second
– Salgar
8 hours ago
2
2
Re: "It correctly returns 16, as I would expect" -- by definition, the result of
sizeof is correct, regardless of what you expect.– Pete Becker
8 hours ago
Re: "It correctly returns 16, as I would expect" -- by definition, the result of
sizeof is correct, regardless of what you expect.– Pete Becker
8 hours ago
Hmm yeah it's the access specifier; add
public:.– Lightness Races in Orbit
8 hours ago
Hmm yeah it's the access specifier; add
public:.– Lightness Races in Orbit
8 hours ago
@LightnessRacesinOrbit not a bug. Aggregates can't have private members
– NathanOliver
8 hours ago
@LightnessRacesinOrbit not a bug. Aggregates can't have private members
– NathanOliver
8 hours ago
|
show 5 more comments
2 Answers
2
active
oldest
votes
This all boils down to whether your type is an aggregate or not. With
struct Base
Base()
double foo;
int bar;
;
struct Derived : public Base
int baz;
;
Base is not an aggregate because of the constructor. When you remove the constructor, you make Base an aggregate which, per Adding a default constructor to a base class changes sizeof() a derived type, means gcc won't "optimize" for space and the derived object won't use the base's tail padding.
When you change the code to
class Base
double foo;
int bar;
;
struct Derived : public Base
int baz;
;
foo and bar are now private (becauses classes have private accessibility by default) which again means Base is no longer an aggregate as aggregates are not allowed to have private members. This means we are back to how the first case works.
add a comment |
With your Base class you will get 4 bytes of tail padding, and the same with the Derived class, that's why it should normally be 24 bytes total for the size of Derived.
It becomes 16 bytes, because your compiler is able to do tail padding reuse.
However tail padding reuse is problematic with POD types (all members public, defaulted constructor, etc...), because it breaks common assumptions a programmer would make. (So basically any sane compiler won't do tail padding reuse for pod types)
Let's pretend compilers would use the tail padding reuse for POD types:
struct Base
double foo;
int bar;
;
struct Derived : Base
int baz;
;
int main(int argc, char** argv)
// if your compiler would reuse the tail padding then the sizes would be:
// sizeof(Base) == 16
// sizeof(Derived) == 16
Derived d;
d.baz = 12;
// trying to zero *only* the members of the base class,
// but this would zero also baz from derived, not very intuitive
memset((Base*)&d, 0, sizeof(Base));
printf("%d", d.baz); // d.baz would now be 0!
When adding an explicit constructor to the Base class, or by changing the struct keywords to class, the Derived class doesn't satisfy the POD definition anymore and therefore tail padding reuse doesn't happen.
New contributor
Turtlefight is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f57114179%2fdifference-between-class-and-struct-in-with-regards-to-padding-and-inheritance%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
This all boils down to whether your type is an aggregate or not. With
struct Base
Base()
double foo;
int bar;
;
struct Derived : public Base
int baz;
;
Base is not an aggregate because of the constructor. When you remove the constructor, you make Base an aggregate which, per Adding a default constructor to a base class changes sizeof() a derived type, means gcc won't "optimize" for space and the derived object won't use the base's tail padding.
When you change the code to
class Base
double foo;
int bar;
;
struct Derived : public Base
int baz;
;
foo and bar are now private (becauses classes have private accessibility by default) which again means Base is no longer an aggregate as aggregates are not allowed to have private members. This means we are back to how the first case works.
add a comment |
This all boils down to whether your type is an aggregate or not. With
struct Base
Base()
double foo;
int bar;
;
struct Derived : public Base
int baz;
;
Base is not an aggregate because of the constructor. When you remove the constructor, you make Base an aggregate which, per Adding a default constructor to a base class changes sizeof() a derived type, means gcc won't "optimize" for space and the derived object won't use the base's tail padding.
When you change the code to
class Base
double foo;
int bar;
;
struct Derived : public Base
int baz;
;
foo and bar are now private (becauses classes have private accessibility by default) which again means Base is no longer an aggregate as aggregates are not allowed to have private members. This means we are back to how the first case works.
add a comment |
This all boils down to whether your type is an aggregate or not. With
struct Base
Base()
double foo;
int bar;
;
struct Derived : public Base
int baz;
;
Base is not an aggregate because of the constructor. When you remove the constructor, you make Base an aggregate which, per Adding a default constructor to a base class changes sizeof() a derived type, means gcc won't "optimize" for space and the derived object won't use the base's tail padding.
When you change the code to
class Base
double foo;
int bar;
;
struct Derived : public Base
int baz;
;
foo and bar are now private (becauses classes have private accessibility by default) which again means Base is no longer an aggregate as aggregates are not allowed to have private members. This means we are back to how the first case works.
This all boils down to whether your type is an aggregate or not. With
struct Base
Base()
double foo;
int bar;
;
struct Derived : public Base
int baz;
;
Base is not an aggregate because of the constructor. When you remove the constructor, you make Base an aggregate which, per Adding a default constructor to a base class changes sizeof() a derived type, means gcc won't "optimize" for space and the derived object won't use the base's tail padding.
When you change the code to
class Base
double foo;
int bar;
;
struct Derived : public Base
int baz;
;
foo and bar are now private (becauses classes have private accessibility by default) which again means Base is no longer an aggregate as aggregates are not allowed to have private members. This means we are back to how the first case works.
edited 7 hours ago
answered 8 hours ago
NathanOliverNathanOliver
109k19 gold badges163 silver badges241 bronze badges
109k19 gold badges163 silver badges241 bronze badges
add a comment |
add a comment |
With your Base class you will get 4 bytes of tail padding, and the same with the Derived class, that's why it should normally be 24 bytes total for the size of Derived.
It becomes 16 bytes, because your compiler is able to do tail padding reuse.
However tail padding reuse is problematic with POD types (all members public, defaulted constructor, etc...), because it breaks common assumptions a programmer would make. (So basically any sane compiler won't do tail padding reuse for pod types)
Let's pretend compilers would use the tail padding reuse for POD types:
struct Base
double foo;
int bar;
;
struct Derived : Base
int baz;
;
int main(int argc, char** argv)
// if your compiler would reuse the tail padding then the sizes would be:
// sizeof(Base) == 16
// sizeof(Derived) == 16
Derived d;
d.baz = 12;
// trying to zero *only* the members of the base class,
// but this would zero also baz from derived, not very intuitive
memset((Base*)&d, 0, sizeof(Base));
printf("%d", d.baz); // d.baz would now be 0!
When adding an explicit constructor to the Base class, or by changing the struct keywords to class, the Derived class doesn't satisfy the POD definition anymore and therefore tail padding reuse doesn't happen.
New contributor
Turtlefight is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
With your Base class you will get 4 bytes of tail padding, and the same with the Derived class, that's why it should normally be 24 bytes total for the size of Derived.
It becomes 16 bytes, because your compiler is able to do tail padding reuse.
However tail padding reuse is problematic with POD types (all members public, defaulted constructor, etc...), because it breaks common assumptions a programmer would make. (So basically any sane compiler won't do tail padding reuse for pod types)
Let's pretend compilers would use the tail padding reuse for POD types:
struct Base
double foo;
int bar;
;
struct Derived : Base
int baz;
;
int main(int argc, char** argv)
// if your compiler would reuse the tail padding then the sizes would be:
// sizeof(Base) == 16
// sizeof(Derived) == 16
Derived d;
d.baz = 12;
// trying to zero *only* the members of the base class,
// but this would zero also baz from derived, not very intuitive
memset((Base*)&d, 0, sizeof(Base));
printf("%d", d.baz); // d.baz would now be 0!
When adding an explicit constructor to the Base class, or by changing the struct keywords to class, the Derived class doesn't satisfy the POD definition anymore and therefore tail padding reuse doesn't happen.
New contributor
Turtlefight is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
With your Base class you will get 4 bytes of tail padding, and the same with the Derived class, that's why it should normally be 24 bytes total for the size of Derived.
It becomes 16 bytes, because your compiler is able to do tail padding reuse.
However tail padding reuse is problematic with POD types (all members public, defaulted constructor, etc...), because it breaks common assumptions a programmer would make. (So basically any sane compiler won't do tail padding reuse for pod types)
Let's pretend compilers would use the tail padding reuse for POD types:
struct Base
double foo;
int bar;
;
struct Derived : Base
int baz;
;
int main(int argc, char** argv)
// if your compiler would reuse the tail padding then the sizes would be:
// sizeof(Base) == 16
// sizeof(Derived) == 16
Derived d;
d.baz = 12;
// trying to zero *only* the members of the base class,
// but this would zero also baz from derived, not very intuitive
memset((Base*)&d, 0, sizeof(Base));
printf("%d", d.baz); // d.baz would now be 0!
When adding an explicit constructor to the Base class, or by changing the struct keywords to class, the Derived class doesn't satisfy the POD definition anymore and therefore tail padding reuse doesn't happen.
New contributor
Turtlefight is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
With your Base class you will get 4 bytes of tail padding, and the same with the Derived class, that's why it should normally be 24 bytes total for the size of Derived.
It becomes 16 bytes, because your compiler is able to do tail padding reuse.
However tail padding reuse is problematic with POD types (all members public, defaulted constructor, etc...), because it breaks common assumptions a programmer would make. (So basically any sane compiler won't do tail padding reuse for pod types)
Let's pretend compilers would use the tail padding reuse for POD types:
struct Base
double foo;
int bar;
;
struct Derived : Base
int baz;
;
int main(int argc, char** argv)
// if your compiler would reuse the tail padding then the sizes would be:
// sizeof(Base) == 16
// sizeof(Derived) == 16
Derived d;
d.baz = 12;
// trying to zero *only* the members of the base class,
// but this would zero also baz from derived, not very intuitive
memset((Base*)&d, 0, sizeof(Base));
printf("%d", d.baz); // d.baz would now be 0!
When adding an explicit constructor to the Base class, or by changing the struct keywords to class, the Derived class doesn't satisfy the POD definition anymore and therefore tail padding reuse doesn't happen.
New contributor
Turtlefight is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 7 hours ago
New contributor
Turtlefight is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 7 hours ago
TurtlefightTurtlefight
3661 silver badge6 bronze badges
3661 silver badge6 bronze badges
New contributor
Turtlefight is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Turtlefight is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f57114179%2fdifference-between-class-and-struct-in-with-regards-to-padding-and-inheritance%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Half a dupe of stackoverflow.com/q/47914612/560648. I don't know why changing the keyword introducing the base would make a difference though (given that there's no member re-ordering going on anyway so differing member access levels oughtn't come into it)
– Lightness Races in Orbit
8 hours ago
Ah thanks! That answer the first question, but not the second
– Salgar
8 hours ago
2
Re: "It correctly returns 16, as I would expect" -- by definition, the result of
sizeofis correct, regardless of what you expect.– Pete Becker
8 hours ago
Hmm yeah it's the access specifier; add
public:.– Lightness Races in Orbit
8 hours ago
@LightnessRacesinOrbit not a bug. Aggregates can't have private members
– NathanOliver
8 hours ago