Comments (3)
Thanks for those clarifications @bogiord! I've updated the answer now with your suggested wording, plus some references to the standard: http://cppquiz.org/quiz/question/17?result=OK&answer=abBA&did_answer=Answer
from cppquiz.
Thanks a lot for taking the time to notify me! The answer is now fixed: http://cppquiz.org/quiz/question/17?result=OK&answer=abBA&did_answer=Answer
from cppquiz.
There are no inherited constructors in the example. Changing "inherited constructor" to "derived class constructor" would be better, I think, but still not strictly correct. According to [class.base.init]/13, the initialization of bases is part of the execution of a derived class constructor, not something that happens before it. I guess a strict wording could be:
- The base class is initialized (by calling its constructor) before the compound-statement of the derived class constructor body is executed.
or (this sounds better to me - it emphasizes who's in control):
- The derived class constructor first calls the base class constructor, and then executes the compound-statement of its own body.
(The body of the constructor includes the ctor-initializer, hence compound-statement to strictly specify what gets executed.)
Also, "inherited destructor" -> "derived class destructor", but see [class.dtor]/9 - it's the same problem. I'd say:
- The body of the derived class destructor is executed before the base class destructor.
or
- The derived class destructor first executes its own body, and then calls the base class destructor.
(The quotes are from the latest draft, but the paragraphs haven't changed since C++11, except for a tiny correction for destructors.)
from cppquiz.
Related Issues (20)
- Add the ability to get to the next sequential question HOT 5
- Drop system tests with lettuce HOT 6
- Better way of freezing requirements HOT 1
- Improved 404 for missing questions HOT 2
- Unexpected bold formatting in the 124's explanation HOT 1
- Compiler Explorer's link in 339 uses -lpthread instead of -pthread HOT 3
- Stylistic issues in the code of 144 HOT 1
- Port the questions to C++23 HOT 11
- CI runs twice on PRs from the same repo HOT 5
- Use a proper software license
- Question #231 HOT 4
- Question #127 HOT 2
- Typo in Question №174 HOT 1
- Question 323 wrong result HOT 2
- Question 244 seems to have incorrect answer HOT 1
- Confused by Question #147 HOT 5
- English grammar issue in question №15 HOT 1
- Improvements to the answer of question №124 HOT 2
- Question #251 has a potentially unsafe link HOT 2
- Adding questions on C-language, as separate chapter HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cppquiz.