Link to home
Start Free TrialLog in
Avatar of rdukb
rdukb

asked on

What is reflection in C++?

I am trying to find out about reflection in C++. I've so far not been able to locate the right definition of term or the application of it in C++. Can someone give a brief explanation about it.

Thanks a lot.

Avatar of jhance
jhance

I'm unfamiliar with the term "reflection" in the context of C++ programming.  Please elaborate.
ASKER CERTIFIED SOLUTION
Avatar of mnashadka
mnashadka

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rdukb

ASKER

To be honest I do not know the context. I was asked this question recently in an Interview and I was curious to find out the correct answer.
maybe he was referring to reflection-X, a lot of companies have windows workstations that talk to unix development servers.

Just a thought.
It is a trick (or poorly phrased) question:

Reflection is common in Java:

Reflection enables Java code to discover information about the fields, methods and constructors of loaded classes, and to use reflected fields, methods, and constructors to operate on their underlying counterparts on objects, within security restrictions. The API accommodates applications that need access to either the public members of a target object (based on its runtime class) or the members declared by a given class.

As mnashadka said, RTTI is a first step in that direction, but really is not a complete enough to be termed reflection.

For a more in-depth discussion, try:

http://www.garret.ru/~knizhnik/cppreflection/docs/reflect.html
Avatar of rdukb

ASKER

Thanks. I found that indeed this is the case. gj62, thanks I saw the article.
what is the point of a reflection