- Q How many Joomla tables are related with users?
- Q The first Asian country to start Community Development Project:
- Q What is http methods?
- Q What techniques used during an audit?
- Q A marketplace named_______is recorded as a Roman trading destination from the mid 1st century.
- Q What does the term panel refer to with regard to pages?
- Q The azygos vein commences as the continuation of the A. right ascending lumbar vein B. left ascending lumbar vein C. hemiazygos vein D. accessory hemiazygos vein E. posterior intercostal veins of the right side
- Q What are the naming conventions used for aggregates created from query?
- Q What are sv and sh waves?
- Q Which was the 1st non Test playing country to befit India in an international match?
- Q which inflorescence is found in Geocalycaceae family?
Question
I'm getting the same mess with destructors: calling a virtual on my this object from my base class's destructor ends up ignoring the override in the derived class; what's going on?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Answers
C++ is protecting you from yourself. What you are trying to do is very dangerous, and if the compiler did what you wanted, you'd be in worse shape.
For rationale of why C++ needs to protect you from that danger, read FAQ 3]. The situation during a destructor is analogous to that during the constructor. In particular, within the {body} of Base::~Base(), an object that was originally of type Derived has already been demoted (devolved, if you will) to an object of type Base. If you call a virtual function that has been overridden in class Derived, the call will resolve to Base::virt(), not to the override Derived::virt(). Same goes for using typeid on the this object: the this object really has been demoted to type Base; it is no longer an object of type Derived.
Read FAQ 3] for more insight on this matter. Your Comment
For rationale of why C++ needs to protect you from that danger, read FAQ 3]. The situation during a destructor is analogous to that during the constructor. In particular, within the {body} of Base::~Base(), an object that was originally of type Derived has already been demoted (devolved, if you will) to an object of type Base. If you call a virtual function that has been overridden in class Derived, the call will resolve to Base::virt(), not to the override Derived::virt(). Same goes for using typeid on the this object: the this object really has been demoted to type Base; it is no longer an object of type Derived.
Read FAQ 3] for more insight on this matter. Your Comment
- 0
- 0
- New Answer
- Contributors: *,
More Software Questions..
What is the inputsplit in map reduce software?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is software configuration management?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What Is Java Api For Xml-based Rpc (jax-rpc)?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How can you implement fine-grained auditing?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is IBM’s simple explanation for Big Data’s four critical features?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is static synchronized method in JDBC API? Give an example?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What does the NULLIF function do?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What happens if a start method is not invoked and the run method is directly invoked?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Should we override finalize method
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
what is the difference between mysql_fetch_array and mysql_fetch_object?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How will XML affect my document links?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Why to use Style Sheets?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What are Filters in MVC?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Can you explain Application layer in OSI model?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How to define new testplan attributes?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What are the minimum system requirements to run Photoshop? Is it possible to run Photoshop over linux?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Which oracle package is used to manage the oracle lock management services?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is Latch Up? Explain Latch Up with cross section of a CMOS Inverter. How do you avoid Latch Up?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is marker interface?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What types of partitioning are there for BW?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,