如何在一個類中調用另一個類的一個方法?如何調用另一個類的對象上的一個類的函數?
我有;
class A {
public :
foo () ;
};
class B {
public :
bar () ;
};
主:
A data ; // I am creating instance of class A
data . bar () ; // but, I am calling a method of another class
// how can I do that ?
注:我無法找到一個合適的標題。如果你有一個,隨時分享或編輯
你想要做什麼? – Potatoswatter
有關派生類的快速參考可能會有所幫助。 http://en.cppreference.com/w/cpp/language/derived_class –