Menu

c++ rule about #49 : duplicated inherited data member

2022-05-19
2022-05-19
  • kangshinhyeok

    kangshinhyeok - 2022-05-19

    the rule #49 is
    duplicated inherited data member

    its mean member is duplicated about child, parent class both
    but in parent class, the member is list of parent object, and
    in child class, the member is list of child's object
    it has same meaning about each object's list (instancesArray)
    but child class has more member or method, so object lists are different

    i think it calls 'hiding'? i guess
    just child class hiding parent class's same name member
    so i want to use parent class's object list, and childs class list both

    is that rule is effectively?? or has some danger whit hiding?
    i just ask for question not for tackle :) please teach me

     
    • Daniel Marjamäki

      the rule #49 is duplicated inherited data member

      I don't understand. What is "#49" from? Cppcheck does not number the warnings.

       
    • Daniel Marjamäki

      is that rule is effectively?? or has some danger whit hiding?

      It is not a definite bug to hide a member. If you really want to do it.. then it's ok.

      The danger is that you will access the wrong member by mistake.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.