【发布时间】:2013-07-06 06:00:13
【问题描述】:
无论如何我可以通过如下类传递参数。
class cat
{public:
void dog(int ID, char *value) // int ID I'd like to be the index array it was called from?
{
debug(ID, value);
}
}
cat cats[18];
cats[1].dog("value second arg, first arg auto filled from index array");
【问题讨论】:
-
我不明白你想要什么。换个说法,这对我来说没有意义。原样
-
你为什么把类和方法命名为同一个东西?这让你更难说出你想要做什么。
-
我想在作为传递的索引数组的类中存储一个名为 ID 的 INT。
-
“通过类传递参数”是什么意思?您可能对类的概念感到困惑。
-
我要做的就是从类数组索引中传递 dog 的第一个参数,在这个例子中是 1。
标签: c++ class parameter-passing