The new b
added in the derived class doesn’t override base’s b
. It just hides it.
So, in the derived class you have two b
and the virtual method prints corresponding b
.
More Related Contents:
- How does #include work in C++? [duplicate]
- std::function vs template
- Why is the destructor of a future returned from `std::async` blocking?
- How to return a std::string.c_str()
- When is a private constructor not a private constructor?
- C++ – Why is boost::hash_combine the best way to combine hash-values?
- Reading from ifstream won’t read whitespace
- Is there a non-atomic equivalent of std::shared_ptr? And why isn’t there one in ?
- When is overloading pass by reference (l-value and r-value) preferred to pass-by-value?
- Passing shared pointers as arguments
- Lambda capture and parameter with same name – who shadows the other? (clang vs gcc)
- void_t “can implement concepts”?
- Configuring the GCC compiler switches in Qt, QtCreator, and QMake
- How to do serialization of Class having members of custom data types in C++? [closed]
- Does std::mt19937 require warmup?
- Is it valid to bind non-const lvalue-references to rvalues in C++ 11?(modified)
- Using `std::function` to call non-void function
- What’s the difference between parentheses and braces in c++ when constructing objects
- cc1plus: error: unrecognized command line option “-std=c++11” with g++
- How do I pass multiple ints into a vector at once?
- Is it wise to ignore gcc/clang’s “-Wmissing-braces” warning?
- Why does pointer to int convert to void* but pointer to function convert to bool?
- Can std::vector emplace_back copy construct from an element of the vector itself?
- Is there a C++11 syntax file for vim?
- C++11: Replace all non-owning raw pointers with std::shared_ptr()?
- templated typedef?
- weak_ptr, make_shared and memory deallocation
- Questions regarding C++ non-POD unions
- C++ Passing std::string by reference to function in dll
- “What happened to my SFINAE” redux: conditional template class members?