Modify contents in base class from external class and accessing it from derived class
===

I have a base class and a derived class and another external class.
I try to update a value in the base class from the external class and 
access it from the derived class.

My class structure is like below:

    class B:{

    bool flag;
  
    setFlag(bool value){
    flag = value;
    }
    printFlag(){
    print flag;
    }

    ExternalClass e = new ExternalClass(this);
    }

    class External {
    B b = null;
    External( B b){
    this.b = b;
    }
    b.setFlag(true);

    }

    Class Derived : extends B{

    printFlag();
    }

Here though i have set the flag to true, the print method prints false.
I dont have a clue as to what is happening . Kindly help me out.


![Description Image][1]


  [1]: http://i.stack.imgur.com/LRexV.jpg