Web Development

General discussion


Access to C++ pointer type

By albert_orr ·
A recent C++ article compared C and C++ pointers, stating that C++ pointers have attributes such as 'type'. Is there a way to find the type of a pointer selected from an array of pointers, and use that pointer to guide the next step in the program?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

comparison C and C++ pointers

by asivakumar In reply to Access to C++ pointer typ ...

The c++ pointers type can be identified by the RTTI Information ,their is system function called typeid(specify the type u want to check).name() which will return you type of data u r using ..

sivakumar a

Collapse -

Can we avoid the need to determine object type?

by macgrrl In reply to Access to C++ pointer typ ...

Two of the fundamental tenets of Object Oriented Programming are inheritance and polymorphism. Careful design of the class hierarchy with virtual methods will often obviate the need for type determination at runtime - which comes with a performance hit.

Collapse -

c/c++ is an assembler macro language

by jp In reply to Can we avoid the need to ...

if yr problem space allows pure object oriented techniques, why use c++ at all.

you cld use java or python, or even lisp, & it wld be a lot mor fun.

for me, part of the fun of c/c++ is that if i want to i can write my own java, python or even lisp objects, outside of the restrictions of those languages. yippee.

& if that means not being object oriented, & casting void pointers into mission critical intelligent agents, i will do it w/out apologies.


Related Discussions

Related Forums