declare the same meber in base and child

Discussion in 'C++' started by jalalsad, Nov 10, 2009.

  1. jalalsad

    jalalsad New Member

    Joined:
    Nov 10, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    C++ allow to declare a member with the same name in parent and child class but ignores the base member is there any way to prevent declaring a member in base and child by compiler setting that compiler generate error for that?
    thanks.
     
  2. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    2
    Trophy Points:
    0
    No. Its not an error and you cannot flag it as error but yes you can have the member as private.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice