private

    1熱度

    1回答

    我目前正在研究利用兩個向量創建鄰接矩陣的模板圖類。我可以在模板類之外工作,但似乎無法初始化矢量。 以下是我有: #include <stdexcept> #include <vector> #include <list> #include <string> using namespace std; namespace GraphNameSpace { template <

    0熱度

    1回答

    我已經有這個問題好幾個小時了,我不能爲我的生活弄清楚什麼是錯的......我不是代碼親,所以我可能錯過了一些真正的東西簡單。我想要做的是將數據從我的控制器方法傳輸到我的模型。請告訴我如何以最好的方式解決這個問題。 控制器: class Some_controller extends CI_Controller { function controller_method() {

    0熱度

    2回答

    我是一個新手在java中,我不知道如何從一個私人類到另一個調用變量。 目前我使用NetBeans 8.1和這裏的類從中我想取值 public class Mars { public static String name; private static int fuel; private static int AI; private static int tecnology; public

    9熱度

    3回答

    你好,我想知道爲什麼C++標準允許我們在嵌套類訪問外部類的私有字段,而禁止從外部類訪問內部類的私有字段。我明白,這個例子: class OuterClass{ public: class InnerClass{ public: void printOuterClass(OuterClass& outer) {cout << outer.m_dataToDispla

    3熱度

    2回答

    考慮下面的代碼在我的圖書館: pub struct Foo; impl Foo { fn helper(&self) { /* .. */ } } pub fn do_something(foo: &Foo) { foo.helper(); } 我的媒體庫的用戶應該能夠使用Foo和do_something(),但應當從未致電helper()。一切工作正常與上面的代

    0熱度

    2回答

    我試圖讓一個私有變量(極限)的值,但我得到了以下錯誤: Fatal error: Uncaught Error: Using $this when not in object context in /home/vagrant/Code/wp/wp-content/plugins/StorePress/app/library/Pagination.php on line 36 我的班級: class

    2熱度

    3回答

    我正在嘗試一個小例子來實踐繼承和多態的概念。這裏是我的代碼的簡化版本: class Shape { protected: int length; int width; public: virtual void setLength(int l) = 0; virtual void setWidth(int w) = 0; }; class Recta

    -3熱度

    1回答

    我正在尋找一種方法來以最佳方式(在安全性和效率方面)訪問同一類的其他對象的訪問變量。 例如,我有一個Point類包含座標,其中的對象應該能夠計算到其他點的距離。 class Point { public: calc_distance(?); private: double mXCoord, mYCoord; }; 我可以通過使座標公共做到這一點,計算此類課程以外的距離

    1熱度

    1回答

    我相信Java中的枚舉構造函數是私有的,但我最近切換到了IntelliJ,它說​​當我將它添加到構造函數中時,private關鍵字是多餘的。 圖片: http://puu.sh/nYbwp/1c37312777.png 不只是Java的自動讓他們私人的東西?

    2熱度

    2回答

    從私人GitHub存儲庫安裝Cordova插件的首選方式是什麼? 我已經從提供者那裏購買了一個私人插件,他們授予我的git賬戶訪問其私人git存儲庫的權限。通常我從科爾多瓦CLI安裝插件有: cordova plugin add https://github.com/somePrivateRepo/purchasedPlugin.git 但得到以下錯誤: Error: Failed to fe