Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!

Timeline for answer to What is dynamic type of object by Klaim

Current License: CC BY-SA 3.0

Post Revisions

10 events
when toggle format what by license comment
Oct 9, 2011 at 19:15 vote accept user103214
Oct 4, 2011 at 22:10 comment added Klaim @arne You are using a non-const reference with a temporary. That will not even compile. It would with a const reference if I remember correctly.
Oct 4, 2011 at 15:34 comment added Klaim @user974191 Do you mean, how is implemented inheritance? Maybe look for "virtual table". In you example the "dynamic type" aka "real type known at runtime" is obviously Derived. However, in some code, you can work with a Base type that in fact is something else without having to know.
Oct 4, 2011 at 15:33 history edited Klaim CC BY-SA 3.0
use pointers only when you have to
Oct 4, 2011 at 15:23 comment added user103214 In my example, I have virtual functions which means that calls will be resolved at runtime. how does dynamic applies here when there is no dynamic binding?
Oct 4, 2011 at 15:15 comment added arne Wouldn't A &k = B(); suffice?
Oct 4, 2011 at 14:53 comment added user124493 +1, but I think you could make the example even more clear by adding an example that does not use new at all.
Oct 4, 2011 at 14:51 history edited Robᵩ CC BY-SA 3.0
deleted 1 characters in body
Oct 4, 2011 at 14:49 history edited duffymo CC BY-SA 3.0
another person who can't distinguish "its" from "it's"
Oct 4, 2011 at 14:45 history answered Klaim CC BY-SA 3.0