w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Accessing parent class instance variables from child class instances

Your preprocessor should be protected or public to be able to have an access from the child. You can read about modifiers here.


new ServiceChildOne(new Preprocessor());

class ServiceChildOne extends Service {

    public ServiceChildOne(Preprocessor preprocessor) {
       super.preprocessor = preprocessor;

    public void executePhaseOne() {
        // Do stuff

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.