getter

    4熱度

    1回答

    製作的打字稿發電機的方法很簡單: class Foo { *values() { yield 10 } } 但我想使發電機財產,這樣的事情: class Foo { get *values() { yield 10 } } ,但似乎無效。我似乎無法找到任何對此問題或解決方法的引用(除了顯式使用Object.defineProperty之外,這會吸引因爲它是無類型的)

    1熱度

    1回答

    我有一個實現一個接口的對象集合,我想讓它有getters來獲取單獨的實現,只有在C++中。在Java中,我會這樣做: interface IFooBar { } class Foo implements IFooBar { } class Bar implements IFooBar { } class Container extends HashSet<IFooBar> {

    0熱度

    2回答

    在我的CS類的跳棋遊戲中,我遇到了計算棋盤上特定顏色棋子的數量的麻煩。 下面是getter方法: public int getCheckersBlue() { int counter = 0; for(int x = 0; x <= 8; x++) { for(int y = 0; y <= 12; y++) { if(c[x]

    -1熱度

    1回答

    我需要吸氣到雙倍返還到0.2小數位... public double getPrice() { double totalPrice = 0.00; DecimalFormat deciFormat = new DecimalFormat("#.00"); ... return Double.valueOf(deciFormat.format(totalPrice));

    -2熱度

    4回答

    我在寫座標系統的程序,所以我需要經常使用座標。我決定使用Point類,因爲它顯然允許輕鬆存儲點的座標。 問題是無處不在我的節目,我使用getX()和getY()方法時,它存儲爲int,而Point收益的兩倍。當然,我可以輕鬆地將它投射到int,但它看起來不太優雅,並增加了不必要的混亂代碼。 如果我直接獲取值,可以嗎?就像這樣: Point p = new Point(0, 0); int x =

    0熱度

    2回答

    如何在Eclipse中爲內部類生成getter和setter?我只找到這樣的信息。這對回答我的問題沒有用:that和that。

    0熱度

    1回答

    我有一些已經在數據庫中創建的表。遷移似乎要求您首先銷燬表並創建它。根據我的理解,創作過程同時會產生一個「模型」,以及這些領域的「吸氣器」和「製作者」。 問題是我已經有一個已滿表的數據庫。我想訪問已經使用Laravel創建的表作爲界面。有沒有辦法爲已經存在的表生成模型,getter和setter? 我該如何做到最好? TIA

    0熱度

    2回答

    我真的需要你的幫助。唐t be scared of a title, cause I don噸真的知道如何描述一個問題。所以我有一個陣列 public static final Server[] SERVERS = { new Server(0, "Test0", "localhost", "00000", "client"), new Server(1, "Test1",

    1熱度

    2回答

    代碼: class Pizza: def __init__(self, toppings): self.toppings = toppings self._pineapple_allowed = False @property def pineapple_allowed(self): return self._pineapple_all

    0熱度

    1回答

    因此,我需要從後端檢索數據並逐個回顯屬性。 所以這是我Pasien.php類那裏有setter和getter: <?php namespace Hospinet; class Pasien { private $Tgl_Lahir; private $Tgl_Masuk; private $Perawatan; private $No_Kamar;