473,806 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reflection in C++

Hi All,

I have query regarding "C++ and Reflection". I could not get sufficient
information from net on this topic.

Does C++ support reflection or any features similar to some other
languages like Java?

As far as I understand C++ does support a feature on RTTI. At lest I
have not used it for anything more than simple object identidy
verification. Can it be classified as a sort of relection or rather can
this RTTI feature be used for any other purpose?

Finally in languages like Java reflection is widely used and is
considered as a useful feature. Are there any efforts going on to make
available true reflection features in C++ too.
Thanks
Sujit

Oct 21 '05 #1
7 4155
sujit wrote:
Hi All,

I have query regarding "C++ and Reflection". I could not get sufficient
information from net on this topic.

Does C++ support reflection or any features similar to some other
languages like Java?

As far as I understand C++ does support a feature on RTTI. At lest I
have not used it for anything more than simple object identidy
verification. Can it be classified as a sort of relection or rather can
this RTTI feature be used for any other purpose?

Finally in languages like Java reflection is widely used and is
considered as a useful feature. Are there any efforts going on to make
available true reflection features in C++ too.


If I google for "c++ reflection" the two top-most links I get seem to give a good
starter:

http://www.vollmann.com/en/pubs/meta/meta/meta.html
http://www.garret.ru/~knizhnik/cppre...s/reflect.html

And no, the C++ language does not support reflection.
Stefan
--
Stefan Naewe
naewe.s_AT_atla s_DOT_de
Oct 21 '05 #2
sujit wrote:
As far as I understand C++ does support a feature on RTTI. At lest I
have not used it for anything more than simple object identidy
verification. Can it be classified as a sort of relection or rather can
this RTTI feature be used for any other purpose?


Anything can be classified as a "sort of" any other thing.

--
Salu2
Oct 21 '05 #3
On 21 Oct 2005 05:03:02 -0700, "sujit" <su************ *@gmail.com>
wrote:
Hi All,

I have query regarding "C++ and Reflection". I could not get sufficient
information from net on this topic.

Does C++ support reflection or any features similar to some other
languages like Java?

As far as I understand C++ does support a feature on RTTI. At lest I
have not used it for anything more than simple object identidy
verification . Can it be classified as a sort of relection or rather can
this RTTI feature be used for any other purpose?

Finally in languages like Java reflection is widely used and is
considered as a useful feature. Are there any efforts going on to make
available true reflection features in C++ too.
Thanks
Sujit


No, C++ does not have a reflection usable as Java reflection is. And I
do like it so, I think Java reflection is a magnificient way of
trashing all safety, abstraction and type checking.

I have always felt the Java reflection is overused and abused.
Oct 21 '05 #4

"sujit" <su************ *@gmail.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hi All,

I have query regarding "C++ and Reflection". I could not get sufficient
information from net on this topic.

Does C++ support reflection or any features similar to some other
languages like Java?
No. C++ supports pointers to functions instead.

Finally in languages like Java reflection is widely used and is
considered as a useful feature. Are there any efforts going on to make
available true reflection features in C++ too.


Why do you need reflection when you have pointers to functions?

Greetings, Bane.
Oct 21 '05 #5
On 21 Oct 2005 05:03:02 -0700, "sujit" <su************ *@gmail.com> wrote:
Finally in languages like Java reflection is widely used and is
considered as a useful feature. Are there any efforts going on to make
available true reflection features in C++ too.


I've always wondered what one can use Java reflection for that cannot be just
as easily, more safely, and more economically done through other means. Can
you shed some light on this?

-dr
Oct 22 '05 #6
* Dave Rahardja:
On 21 Oct 2005 05:03:02 -0700, "sujit" <su************ *@gmail.com> wrote:
Finally in languages like Java reflection is widely used and is
considered as a useful feature. Are there any efforts going on to make
available true reflection features in C++ too.


I've always wondered what one can use Java reflection for that cannot be just
as easily, more safely, and more economically done through other means. Can
you shed some light on this?


Component technologies for languages with reflection are relatively clean;
corresponding technologies for C++ are unclean, to put it mildly.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Oct 22 '05 #7
On Sat, 22 Oct 2005 05:00:08 GMT, al***@start.no (Alf P. Steinbach) wrote:
I've always wondered what one can use Java reflection for that cannot be just
as easily, more safely, and more economically done through other means. Can
you shed some light on this?


Component technologies for languages with reflection are relatively clean;
correspondin g technologies for C++ are unclean, to put it mildly.


What's it used for?

-dr
Oct 22 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1383
by: A. Wiebenga | last post by:
Hi all! I am a student at the Hogeschool van Arnhem en Nijmegen in Holland. I am currently involved in a research project regarding Reflection. Purpose of the research project is to document what Reflection is (I can answer this question myself), what kind of Reflection Techniques there are (.NET Reflection, Python Reflection etc. I can answer this one myself too). The main question I need to answer is related to the implementation of...
10
7375
by: Sunny | last post by:
Hi, I have an old problem which I couldn't solve so far. Now I have found a post in that group that gave me an idea, but I can not fully understand it. The problem is: I'm trying to use a Windows.Forms.UserControl in a COM environment, i.e. I want to host that control in a COM host. So far, so good, I can host it, but I can not reach the parent COM object from the control (Parent property is null :( ). I have stopped the control in the...
2
864
by: Jason Coyne Gaijin42 | last post by:
I have seen several people looking for a way to access the Columns collection when using the AutoGenerate = true option. Some people have gotten so far as to find the private autoGenColumnsArray that has the information, but we as developers have no way to access this information. I have come up with a solution for the problem, (as I am sure many others have) using reflection. Here is some sample code that will print out the auto...
2
2017
by: Mark | last post by:
Am I out of my mind if I use Reflection everytime someone logs into our site to get and track the current Major/Minor/Build/Revision version that the person is viewing our site through? This information would then be logged to a database along with some other information about the user. Thanks in advance. Mark
0
1552
by: Shawn Hogan | last post by:
Hi everyone, I've been trying to execute a control's private event code via reflection from another class with the goal of potentially doing some unit testing. The examples below are trying to execute button2's click event. This works great when i know the name of the method that i want to invoke. I do so by doing this: Dim AssemblyPointer As Reflection.Assembly
3
2332
by: HL | last post by:
The requirement is to send some information to other objects. The objects to whom the information has to be sent is not available at compile time. The names of the types (objects) will be provided through an external file in which case we can use reflection to create objects of that type at run time. Case 1: The methods of those types can be invoked through reflection. Case 2: The caller can publish certain events. The types (objects)...
9
3850
by: Kuberan Naganathan | last post by:
Hello all Does anyone know of a good way to use reflection in c++? I don't mean simply using rtti or dynamic casting. I'm talking about java/c# style reflection where an actual instance of an object can be constructed through reflection and method calls can be made via the reflection apis.
17
2315
by: raylopez99 | last post by:
What good is C# Reflection, other than to find out what types are in an assembly? And to dynamically invoke methods in an assembly (.dll or .exe)? Also, bonus question, can you use Reflection to build a compiler? One that will construct a user defined class "on the fly" (literally, the user defines a class, instantiates it, and runs it from the console mode, all the while prompted by the program)? I guess so, but my final question...
0
1706
by: Gustavo Arriola | last post by:
Hola a todos! Estoy intentando ejecutar un método usando Reflection. El código es el siguiente: public static void SoapHandler(Exception Error) { try { Type assemblyType;
0
9718
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10617
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10364
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5545
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4328
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3849
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.