Explication de dynamic_cast dans la norme.
Bonjour
Je ne comprends pas les phrases suivantes du § 5.2.7, sur le dynamic_cast
Citation:
If, in the most derived object pointed to by v, v points to a public base class suboject of a T object, and if only one object of type T is derived from the sub-object pointed to by v, the result is a pointer to that T object.
Si par exemple on a:
Code:
1 2 3 4 5 6 7
|
class A{};
class B: public A{};
class C: public A{};
class D: public virtual B, public virtual C{};
D d; |
Dans d, qu'est ce que: "in the most derived object pointed to by v"?
Je ne comprends pas trop non plus la phrase:
"and if only one object of type T is derived from the sub-object pointed to by v"
Pouvez vous me donner un exemple svp?
Citation:
Otherwise, if v points to a public base class sub-object of the most derived object, and the type of the most derived object has a base class, of type T, that is unambiguous and public, the result is a pointer to the T sub-object of the most derived object.
Idem, est-ce possible d'avoir un exemple qui illustre la différence?
Merci