Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 277
  • Last Modified:

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.

1 Solution
I'm unfamiliar with the term "reflection" in the context of C++ programming.  Please elaborate.
Run-time type information (RTTI) is similar to the concept of reflection in Java and a couple of other languages.  It's the idea where the class knows a couple of things about itself (such as its name).  Look up typeid.
rdukbAuthor Commented:
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.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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:

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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now