I have class A, is it possible to make sth like this? A(A(A()))? I mean creating some object in constructor and so on?
class A {
private:
A *a;
public:
A(){
printf("A()\n");
}
A( A * var){
printf("A(A)\n");
a = var;
}
};
int main() {
A x = A(A(A()));
return 0;
};
and this give me output A()
, i mean why not A() A(A) A(A)
? My A class represent a memory cell so A(1) is pointing to array[1]
but A(A(1))
is sth like array[array[1]]
. But i don't have idea how to implement this, only one object is created. (this A class is just an example of what I want to achieve)