Can a C++ class have an object of self type? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can a C++ class have an object of self type?

22nd Feb 2017, 7:29 AM
jayesh goyal
jayesh goyal - avatar
2 Answers
+ 5
no
22nd Feb 2017, 7:31 AM
chris
chris - avatar
+ 3
No, not an object; but it can have a pointer to an object of its own type. That's in fact how linked lists work.
22nd Feb 2017, 10:10 AM
Ettienne Gilbert
Ettienne Gilbert - avatar