Skip to Content
0

When child class inherits from parents class should Protected attributes not be available to child?

Oct 12, 2017 at 10:34 AM

28

avatar image

I have a protected attribute in my parent class. My child class inherits from parent class but I get error message "Access to protected attribute is not allowed".

Please advise. Thank you kindly in advance.

protected.png (29.1 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Harald Lesche-Holzbecher
Oct 12, 2017 at 06:21 PM
1

Hi Glen,

you have to access the attribute from inside the method of the child class.

The write you try to execute is from outside of the class and would need public access.

Share
10 |10000 characters needed characters left characters exceeded