473,324 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

relation between typeid and typeinfo class (related by friend ?)

Hi,

typeinfo class has a private constructor and only typeid can return
object to typeinfo class. So here I am wondering how these two are
related. Are these two related through 'friend' so that typeid can
access private methods of typeinfo class.

Can some one list me the exact declaration of typeid and typeinfo class
if they have right away ?

Thanks
Ganesh

Jul 23 '05 #1
3 1848
Ganesh wrote:

Hi,

typeinfo class has a private constructor and only typeid can return
object to typeinfo class. So here I am wondering how these two are
related. Are these two related through 'friend' so that typeid can
access private methods of typeinfo class.
Not in my system.
The important point is: What may be forbidden for you (the programmer)
is not necessarily forbidden for the compiler. The compiler may do
things (such as creating a type_info object although the constructor
is private) which a programmer can't do.

Can some one list me the exact declaration of typeid and typeinfo class
if they have right away ?


You already have them.
In order to use a type_info object, you need to include some header file.
This file contains the declaration.

--
Karl Heinz Buchegger
kb******@gascad.at
Jul 23 '05 #2
ben
Can some one list me the exact declaration of typeid and typeinfo class
if they have right away ?


typeid is NOT a function but an operator believe it or not, so it doesn't
have a declaration. You can either pass in a class or an object for typeid
to return a typeinfo object.

ben
Jul 23 '05 #3
Ganesh wrote:
Hi,

typeinfo class has a private constructor and only typeid can return
object to typeinfo class. So here I am wondering how these two are
related. Are these two related through 'friend' so that typeid can
access private methods of typeinfo class.
typeid is not a function. It is an operator built into the compiler.
Can some one list me the exact declaration of typeid and typeinfo class
if they have right away ?


typeinfo might have one. To find it out, look into the header. typeid
doesn't have any declaration.

Jul 23 '05 #4

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

Similar topics

18
by: Andreas Sch. | last post by:
Hello, I had been quite suprised by the following little program: ---- cut ---- #include "iostream.h" class base {
3
by: Mike | last post by:
I want to use typeid() in a base class function to determine the name of the derived class. typeid(this) returns the name of the base class (which is an abstract class) rather than the derived...
3
by: Max | last post by:
I am trying to find a way to eliminate vararg functions from my code by packaging the input parameters in stringstreams. Here is an oversimplified example of what I am trying to do: Functions...
2
by: Generic Usenet Account | last post by:
My C++ compiler (gcc 3.3.1) is prefixing a number in front on a user-defined structure when I invoke typeid() on it. Can anyone explain why? Source code follows: Bhat ...
1
by: Baget | last post by:
Hello can someone tell me why this code work on Visual C++ 2005 Express and not on Visual C++ 2003 and 6 (it crash) Thanks -=-=- .... C code. C code run. Run, code, run!
18
by: Adam Zimny | last post by:
This is fragment of code from Bruce Eckel's Thinking in c++ ( last 3 couts are mine to show what happened ). The question is: is Bruce Eckel wrong or g++ ( my version is 3.2.3 ) is buggy ? //:...
6
by: ma740988 | last post by:
I was trying to garner a feel for typeid and it's use with polymorphic types #include <iostream> template <class T> bool is_polymorphic() { bool result(false); typeid( (result=true),...
0
by: rengaraj | last post by:
Hello. I have an @Entity class, Person, with a @ManyToMany relation with itself. This relation is the friend association. The code of the class is as follows: @Entity @Table(name = "PERSON",...
7
by: Deepak Jharodia | last post by:
I'm using a templatized class in GCC based environ template<class A, class B> class foo {... ....} F; Now I want to know that particular instance of this class was instantiated with what...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

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.