Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In C++ You Can Have a Pointer to a Function, Can you also have a pointer to a class?

I'm not talking about a pointer to an instance, I want a pointer to a class itself.

like image 848
Alex Gaynor Avatar asked Nov 13 '08 00:11

Alex Gaynor


2 Answers

In C++, classes are not "first class objects". The closest you can get is a pointer to its type_info instance.

like image 142
CesarB Avatar answered Sep 19 '22 19:09

CesarB


No. A pointer is the address of something in the memory of the computer at run-time. A class is just a set of instructions to the compiler.

like image 41
Will Dean Avatar answered Sep 22 '22 19:09

Will Dean