Paul Marques Mota | 8 Jul 2012 12:02
Picon

[Vala] Accessing a foreign class property

Hello,

The following code yields an error  "invocation not supported in this
context". Is there a way for test2 to access test1 property?

public class test1 {

  public enum state {
    FILL,
    DRAW
  }

  private static state _state;

  public static state drawing_state {
    get { return _state; }
    set { _state = value; }
  }

  public void test1 () {
    _state = state.DRAW;
  }
}

public class test2 {
  public static void m () {
    if (test1.drawing_state() == state.FILL) {
      stdout.printf("FILL\n");
    } else {
      stdout.printf("DRAW\n");
(Continue reading)

Thomas Jollans | 8 Jul 2012 12:56
Picon
Favicon
Gravatar

Re: [Vala] Accessing a foreign class property

On 07/08/2012 12:02 PM, Paul Marques Mota wrote:
> "invocation not supported in this context"

Invocation? Let's look for invocation.

>     if (test1.drawing_state() == state.FILL) {
.............................^^

HA! Invocation. It's not possible because it makes no sense:
drawing_state is a property, not a method.

Gmane