why can’t we declare object of a class inside the same class?

Because the class would be infinite in size.

(This is done language-wise by specifying you can’t have incomplete types as members, only reference or pointers to them, and that A is an incomplete type until the end of the class definition.)

Leave a Comment