2 years ago

#58887

test-img

livefun

Length of class object

I have an array AAA *aaa[len], where AAA is a class.

class AAA
{...};

int main()
{
   cin >> len;
   AAA *aaa[len]; // how to get the length of aaa?
}

How to get the length of aaa? I tried sizeof(aaa)/sizeof(AAA) but it is wrong. Obviously, the length of aaa is len, but I want to obtain the length by other methods.

c++

class

sizeof

0 Answers

Your Answer

Accepted video resources