문제

For the following scenario, it didn't work for me. Is there a way to fix it?

class A {
  public static V_A = 'setting_a';
  ...
}

class B {
  public static V_B = A::$V_A;
}
도움이 되었습니까?

해결책

As an answer to my own question - I needed up yanked the static variable V_B in class B, introduced a static function to return the value of A::$V_A, and replace B::$V_B with the function everywhere the static variable is referenced. Essentially, it's what @Abkik suggested.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top