Cannot Access Fields and Methods of Implementation Class Implementing an Interface

Issue #226 new
Calem Bendell created an issue

Given:

class A { 
  class B { }
  class C implements B { }
  private B;
}

If TouchCORE is used to make B an instance of C, then the extensions unique to C cannot be called and a lifeline to class C cannot be drawn, only a lifeline to B.

This is demonstrated in the attached snapshot, where a MinuetoFrame has been created as the class' MinuetoWindow. When the minuetowindow field is assigned the value of the constructor for MinuetoFrame, the lifeline is converted to a MinuetoWindow, from which methods unique to MinuetoFrame cannot be accessed.

This may be user error :-)

Comments (2)

  1. Matthias Schoettle

    If you assign the return to an existing association in the structural view that refers to MinuetoWindow then it makes sense that you can only call operations that MinuetoWindow has.

    What I mean is:

    MinuetoWindow window;
    window = new MinuetoFrame(...);
    // when calling methods on window, you can only call those of MinuetoWindow unless you cast it to MinuetoFrame
    

    If you pressed the plus button to create a local variable, then I agree that it should create one of type MinuetoFrame, but this should work. correct?

  2. Log in to comment