views:

51

answers:

2

How does it work when I only have an object but my function takes a pointer to that type of object.

Someoclass test1;

SomeFunction( Someclass*)
{
    //does something
};
+4  A: 

You pass the address of the object.

SomeFunction(&test1);
UncleBens
Apoc
Necrolis
A: 

To call the function, you need to use the address of operator (&). So in your case:

Someclass test1;

SomeFunction(&test1);

If you are asking how pointers work, there's a detailed explanation here.

JoshD