tsuibin
V2EX  ›  C

继承问题

  •  
  •   tsuibin · May 17, 2016 · 2761 views
    This topic created in 3675 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
        1
    pagict  
       May 17, 2016
    dynamic_cast
    noli
        2
    noli  
       May 30, 2016
    答案是无法知道。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5916 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 02:40 · PVG 10:40 · LAX 19:40 · JFK 22:40
    ♥ Do have faith in what you're doing.