Thread: How know smth is a pointer to an object instead of an object?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    184

    How know smth is a pointer to an object instead of an object?

    If there's a define macro that takes an object, how can it figure out if the object passed is the actual object or a pointer to the object?

    Pseudo code:

    Code:
    #define handleTest( obj )                                             \
         Test* t;                                                         \
                                                                          \
         /* want to do something like this */                             \
         if ( obj isOfType pointer ) t = dynamic_cast<Test*> obj;         \
         else t = &( ( Test ) obj );
    Last edited by 6tr6tr; 04-23-2008 at 10:31 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sorting number
    By Leslie in forum C Programming
    Replies: 8
    Last Post: 05-20-2009, 04:23 AM
  2. Replies: 5
    Last Post: 04-04-2009, 03:45 AM
  3. Pointer question
    By rakan in forum C++ Programming
    Replies: 2
    Last Post: 11-19-2006, 02:23 AM
  4. Compiler "Warnings"
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 04-24-2005, 01:09 PM
  5. trouble with pointer to object
    By drb2k2 in forum C++ Programming
    Replies: 3
    Last Post: 04-16-2003, 03:10 PM