tsuibin
V2EX  ›  C

继承问题

  •  
  •   tsuibin · May 17, 2016 · 2749 views
    This topic created in 3669 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   ·   5650 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 06:10 · PVG 14:10 · LAX 23:10 · JFK 02:10
    ♥ Do have faith in what you're doing.