tsuibin
V2EX  ›  C

继承问题

  •  
  •   tsuibin · May 17, 2016 · 3120 views
    This topic created in 3827 days ago, the information mentioned may be changed or developed.

    Class A{ }; Class B{ }; Class C : A, B{ };

    C * pointerC = new C; B pointerB = (B)pointerC;

    pointerB 如何知道指向的类(pointerC)是否继承了 Class A ?

    2 replies  •  2016-05-30 23:29:07 +08:00
    pagict
    pagict
    May 17, 2016
    1
    dynamic_cast
    noli
    noli
    May 30, 2016
    2
    答案是无法知道。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1648 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 13:18 · PVG 21:18 · LAX 05:18 · JFK 08:18
    ♥ Do have faith in what you're doing.