![](/img/trans.png)
[英]How to check if an element of one array is also element of another in c++?
[英]C++ array of objects. One element to access method of another element in array
我有很多物體
MyClass MyArr[10];
在數組一個元素( MyArr[j] )
方法中,我需要訪問此數組中另一個元素( MyArr[i].Method2(arg) )
。
我該怎么做?
從數組的一個元素訪問數組的另一個元素?
有很多方法。 一些是:
MyArr
成為MyClass
類的靜態變量 MyArr[i]
作為參數傳遞給MyArr[j]
上的方法調用 您可以將數組傳遞給每個對象,也可以找到值得嘗試的鏈表
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.