Can a property of a class be the class itself? [closed]

Yes it can have, this is called self-referencing class.

Why it is not a compiler issue ?

Because you create a pointer to the object of same type, not the object.

This is frequently seen in C / C++ data structures like Linked List.

Browse More Popular Posts

Leave a Comment