digitalmars.D.bugs - [Issue 16412] New: instance variable shadowing with inheritance
- via Digitalmars-d-bugs (33/33) Aug 21 2016 https://issues.dlang.org/show_bug.cgi?id=16412
https://issues.dlang.org/show_bug.cgi?id=16412 Issue ID: 16412 Summary: instance variable shadowing with inheritance Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: spec Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: lodovico giaretart.net CC: lodovico giaretart.net Classes should not be allowed to shadow non-private instance variables from their base: class Parent { int x = 1; } class Child: Parent { int x = 3; } void main() { Child child = new Child(); Parent parent = child; assert(parent is child); // same object assert(parent.x != child.x); // different value for member x } --
Aug 21 2016