| Topic: |
DEVELOP > c-Plus-Plus |
| User: |
"Ganesh" |
| Date: |
10 May 2005 01:45:41 AM |
| Object: |
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
.
|
|
| User: "ben" |
|
| Title: Re: relation between typeid and typeinfo class (related by friend ?) |
10 May 2005 04:46:51 AM |
|
|
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
.
|
|
|
|
| User: "Karl Heinz Buchegger" |
|
| Title: Re: relation between typeid and typeinfo class (related by friend ?) |
10 May 2005 03:15:09 AM |
|
|
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
kbuchegg@gascad.at
.
|
|
|
|
| User: "Rolf Magnus" |
|
| Title: Re: relation between typeid and typeinfo class (related by friend ?) |
10 May 2005 04:53:38 AM |
|
|
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.
.
|
|
|
|

|
Related Articles |
|
|