Link to home
Start Free TrialLog in
Avatar of mike_k
mike_k

asked on

Call method on parent object

I am having trouble calling a method on the parent object.

Right now, I have a class "DEM" that creates an instance of class "Decomposer"  The Decomposer object needs to call a method on DEM, so I call call the constructor from DEM like this:

  Decomposer d = new Decomposer(this);

on Decomposer, the constructor stores a reference to the parent

  private DEM Parent;
  public Decomposer(DEM parentRef){
    Parent = parentRef;
  }

when I try to call a method on the object Parent,
  ArrayList r = (ArrayList) Parent.executeGddQuery(lstrGetFragsSQL);

note: executeGddQuery is a public function on DEM (public List executeGddQuery(String query))

I get a compile error:
  csis532\dem\Decomposer.java:176: cannot resolve symbol
  symbol  : method executeGddQuery (java.lang.String)
  location: interface ddbms.DEM
               ArrayList r = (ArrayList) Parent.executeGddQuery(lstrGetFragsSQL);


Can someone help me to work out calling the parent object's method?

Thanks,
Mike
Avatar of Mick Barry
Mick Barry
Flag of Australia image

The method appears it is not defined in the DEM interface
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial