Hello friends,
How to access the variables of parent class in the child class?
If the variables in the parent class aren't private you can simply access them as
if they're your own. I consider this bad practice because it couples the base class
to the child class even tighter. Have you read a book about this matter or are
you simply asking your homework questions here?
You can use the extends keyword then followed by the name of the class to inherit from.
Yes but that was not what the OP was asking; given his question he seems to
know how to build a child and parent class; he was asking how to access the
variables in the parent class from the child class.
Comment