數組指針對象在C++中,我有對象的像這樣的數組指針:指針在QT
vector<Articulation*> artic;
我有下一個問題。當我發送該矢量到另一個類如&時。所以我有指針,而不是所有的數組都重複。問題在於未來。在新的類,我有數組指針的對象ponter
vector<Articulation*>* pArtic;
在新的I類做pArtic [I] - >移動()。該方法在鉸接中實施。當我執行mov()方法時,QT告訴我,類型std :: vector < _Ty>沒有運算符 - >。這是因爲,我認爲,我無法訪問關節對象,我試圖通過向量移動()。
任何人都知道我必須做什麼才能訪問鉸接對象並執行move()方法?
實施例:
類A:B
vector<Articulation*> artic;
void A::initVector(){...}
void A::sendInfoToB(){
B nuevo();
B.send(&artic);
}
類別:
vector<Articulation*>* pArtic
void B::send(vector<Articulacion*>* art){
pArtic=art;
}
void B::sendToC()
{
C nuevo();
C->sendTheLast(pArtic);
}
C類:
void C::sendTheLast(vector<Articulation*>* artic)
{
string data=artic[i]->move();
//Move returns a String
}
這是示例。
請提供簡單的move()方法體。 –
你能否提供一個**小**示例來說明你想要做什麼並且再現問題?我無法理解你的問題。 – juanchopanza