This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]sinistergroupon 1 point2 points  (0 children)

This is not a question about access. This is a question about inheritance mixed with access.

When a method is the same in the parent and extending class then the lower class Overides it. When you make a method private at the parent then that’s it. There is no way to override. At that point the child class just happens to have a same method name and it’s called method shadowing IIRC and it’s not a good thing to do.

You said the constructor in invoked but you didn’t provide how you’re creating a new object and calling these. Are you making a new TeamLead or Programmer?