Discussion: type_info
Afficher un message
Vieux 08/12/2007, 07h08   #2
Abhishek Padmanabh
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: type_info

On Dec 8, 10:38 am, Rahul <sam_...@yahoo.co.in> wrote:
> Hi Everyone,
>
> I was working with Run Time Type Information and with typeid
> operator, and so on i tried to create an object of type_info class and
> i'm not able to do so, because of the class design,
>
> class type_info {
> public:
> _CRTIMP virtual ~type_info();
> _CRTIMP int operator==(const type_info& rhs) const;
> _CRTIMP int operator!=(const type_info& rhs) const;
> _CRTIMP int before(const type_info& rhs) const;
> _CRTIMP const char* name() const;
> _CRTIMP const char* raw_name() const;
> private:
> void *_m_data;
> char _m_d_name[1];
> type_info(const type_info& rhs);
> type_info& operator=(const type_info& rhs);
>
> };
>
> the constructor and assignment operator is private, why is it so?
>
> Thanks in advance!!!


I believe it so closely coupled with usage of typeid operator and the
specific implementation (by the compiler) that you would not normally
be able to do anything meaninful with it, even if you could create an
object of type_info. The only way to get a type_info object is by
usage of typeid().

It would be interesting to know, why you want to create an object of
it?
  Réponse avec citation
 
Page generated in 0,05504 seconds with 9 queries