Skip to content

Latest commit

 

History

History
11 lines (9 loc) · 368 Bytes

15.9.md

File metadata and controls

11 lines (9 loc) · 368 Bytes

The dynamic type of an expression that is either a reference or a pointer could be different from that expression's static type.

class Base { /* ... */ };
class Derived : public Base { /* ... */ };
Derived d;
Base *bp = &d;
Base &br = d;
Derived *dp = &d;
Base *bp2 = dp;

bp2, bp and br have different static type and dynamic type.