C++

This category contains 28 posts

Beginner’s Guide to C++

Introduction Getting Started Hello World Dissecting “Hello World” Directives Namespaces Entry Streams The Language Variables Types Operators Flow Control Functions Classes Pointers An Application Adding Tasks: Files and Vectors Listing Tasks Marking Tasks as Done Sorting Tasks: Overridden Operators and STL Algorithms Conclusion Introduction C++ is a general purpose programming language. Anyone already programming at … Continue reading »

C++ Full Course

Subscribe now to receive more great content like this! Email Address share on facebook share on twitter

Free C++ Books

1. Fundamentals of Programming C++ (Richard L. Halterman) 2. C++ Annotations (Frank B. Brokken) 3. The C++ Hackers Guide (Steve Oualline) 4. Optimizing Software in C++ (Agner Fog) 5. Programming Abstractions in C++ (Eric S. Roberts) 6. Open Data Structures: An Introduction, in Java and C++ (Pat Morin) 7. Data Structures and Algorithm Analysis in C++, 3rd Edition (Clifford A. Shaffer) 8. Structured Programming … Continue reading »

An Introduction to the Imperative Part of C++

This document is part of the HTML publication “An Introduction to the Imperative Part of C++” The original version was produced by Rob Miller at Imperial College London, September 1996. Version 1.1 (modified by David Clark at Imperial College London, September 1997) Version 1.2 (modified by Bob White at Imperial College London, September 1998) Version … Continue reading »

C++ Interview Question 17 Answer

Answer This question is compilable and deterministic. Its output is “B”. Explanation The “trick” here is that B::f() is called even though it is private. As §11.5.2 in the standard puts it: “Access is checked at the call point using the type of the expression used to denote the object for which the member function … Continue reading »

C++ Interview Question 16 Answer

Answer This question is compilable and deterministic. Its output is “abBA”. Explanation The base class constructor is called before the inherited constructor. The inherited destructor is called before the base class destructor. SOURCE Subscribe now to receive more great content like this! Email Address share on facebook share on twitter

C++ Interview Question 15 Answer

Answer This question is compilable and deterministic. Its output is “abBA”. Explanation Member variables are initialized before the constructor is called. The destructor is called before member variables are destroyed. SOURCE Subscribe now to receive more great content like this! Email Address share on facebook share on twitter

C++ Interview Question 14 Answer

Answer This question is compilable and deterministic. Its output is “acabBA”. Explanation Static local variables are initialized the first time control passes through their declaration. The first time foo() is called, b is attempted initialized. Its constructor is called, which first constructs all member variables. This means A::A() is called, printing a. A::A() then throws … Continue reading »

C++ Interview Question 13 Answer

Answer This question is compilable and deterministic. Its output is “abcBCA”. Explanation §3.6.2¶4 in the standard: “It is implementation-defined whether the dynamic initialization of a non-local variable with static storage duration is done before the first statement of main. If the initialization is deferred to some point in time after the first statement of main, … Continue reading »

C++ Interview Question 12 Answer

Answer This question is compilable and deterministic. Its output is “acbBCA”. Explanation §3.6.2¶4 in the standard: “It is implementation-defined whether the dynamic initialization of a non-local variable with static storage duration is done before the first statement of main. If the initialization is deferred to some point in time after the first statement of main, … Continue reading »