If this was allowed, you could write this:
*bb = new Base;
And c
would end up pointing to an instance of Base
. Bad.
More Related Contents:
- C++ Access derived class member from base class pointer
- Conversion from Derived** to Base**
- Copying derived entities using only base class pointers, (without exhaustive testing!) – C++
- Avoid memory leaks in C++ Pointers [closed]
- Questions regarding constructors
- What does “dereferencing” a pointer mean?
- Is there a way to instantiate objects from a string holding their class name?
- Why are references not reseatable in C++
- C++ virtual function return type
- How to return a std::string.c_str()
- how does the ampersand(&) sign work in c++? [duplicate]
- Why does streaming a char pointer to cout not print an address?
- When should I use raw pointers over smart pointers?
- Deleting a pointer in C++
- Create new C++ object at specific memory address?
- Uninitialized pointers in code
- subtle C++ inheritance error with protected fields
- C++: overriding public\private inheritance
- Why can I call base template class method from derived class
- Why doesn’t reference-to-member exist in C++?
- Using a C string gives a warning: “Address of stack memory associated with local variable returned”
- Why does pointer to int convert to void* but pointer to function convert to bool?
- how do arrays work internally in c/c++
- Understanding -Weffc++
- Why is a c++ reference considered safer than a pointer?
- Safety of casting between pointers of two identical classes?
- How can a char pointer be initialized with a string (Array of characters) but an int pointer not with an array of integer? [duplicate]
- Does ‘auto’ type assignments of a pointer in c++11 require ‘*’?
- Is it possible to have a pointer literal?
- Pass by pointer & Pass by reference [duplicate]