member-variables

    0熱度

    2回答

    我有一個項目在Netbeans 8.0大約12 JavaScript包括。在一個JavaScript類文件中,如果我從該項目實例化另一個自定義類並按「。」。在var名稱後面,它不會彈出任何autocompletes與我的成員變量和項目中的類中的方法。 例子:在一個JavaScript文件有一個類,如: class Person(){ doStuff(){ // sh happ

    1熱度

    3回答

    我只想問一下在C++,頭文件或構造函數中初始化const類成員變量的最佳做法是什麼? 感謝:) 在頭文件: h文件: class ExampleClass{ public: ExampleClass(); private: const std::string& string_member_variable_ = "Sample Text"; } 或 在構造: .h文件中: cla

    -1熱度

    2回答

    我想分配父變量(在子類的構造函數),然後我想使它成爲子類的成員變量。我怎麼能在Qt中做到這一點? 代碼: PopupServer::PopupServer(QWidget *parent) { //I need to store the parent in variable Win //and make it member variable of PopupServer class }

    -1熱度

    1回答

    Layer::Layer(int LayerSize, Layer PrevLayer){ Size=LayerSize; Column=(Neuron*)malloc(Size); for(int i=0;i<Size;i++){ Column[i]=Neuron(LayerSize,LayerSize,LayerSize); Input[i]=&Colum

    -2熱度

    1回答

    我有一個充滿了類的對象的數組列表。這些對象具有像x,y和imagePath這樣的變量。我只想在這個對象之間的數組路徑中對圖像路徑變量進行混洗。所以對象的x和y變量應該保持不變。我怎樣才能做到這一點? 我知道我可以使用collections.shuffle()來洗牌整個數組列表。但是這並不能解決我的問題。

    2熱度

    1回答

    我正在實現與字符串關鍵字相關聯的成員變量指針映射。 所有變量的範圍從基類「BaseA」 從映射訪問變量時,只需要使用基類方法(示例中的getDesc()),因此不需要檢索原始類型。 該代碼編譯並在GNU g ++ 6.2.1下運行,但根據我所讀到的,reinterpret_cast的使用不可移植,並且可能無法與其他編譯器一起使用。 這是正確的嗎?還是這個代碼符合C++標準? 有沒有其他的方式來做到

    1熱度

    1回答

    的這是一個後續問題 mem_fn to function of member object 這是當前的代碼。 #include <vector> #include <algorithm> #include <functional> struct Int { Int(int _x = 0) : x(_x) {} int GetInt() const { return x

    0熱度

    2回答

    如何捕獲對成員變量的訪問? $Class1->{Class2} 如果Class2字段不存在,是否有可能從內部函數中捕獲?

    5熱度

    4回答

    考慮以下兩類: class LunchBox { public: std::vector<Apple> m_apples; }; 和 class ClassRoom { public: std::vector<Student> m_students; }; 的類是一樣的,因爲它們都包含對象的成員變量向量;然而,它們並不相同,因爲矢量的對象是不

    -5熱度

    1回答

    訪問構件,所以我得到一類報頭這樣 class Node{ public: Node* children[6]; int value = 13; Node(); ~Node(); } 正如我明白我的代碼,我創建一個數組引用的到節點對象。 現在在C++中 - 我創建一個子節點並將其保存在我的子數組中。然後我想訪問創建的孩子的價值變量: Node::No