470,815 Members | 1,341 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

How do you specify a reference to a pointer

I want to specify a reference to a pointer. I tried this syntax, and it
didn't compile.

void func(string s, (Type*)& t);

Any thoughts?

Jan 12 '07 #1
2 1206
je***********@yahoo.com wrote in news:1168618970.244074.99080
@l53g2000cwa.googlegroups.com:
I want to specify a reference to a pointer. I tried this syntax, and it
didn't compile.

void func(string s, (Type*)& t);

Any thoughts?


void func(string s, Type *& t);
I suspect that the compiler is attempting to take the address of t, then
casting it to a Type* in your version.
Jan 12 '07 #2
jessica_bo...@yahoo.com wrote:
I want to specify a reference to a pointer. I tried this syntax, and it
didn't compile.

void func(string s, (Type*)& t);

Any thoughts?
The following seems to work for me.

#include <string>

class Type
{
public:
int someData;
};

void func(std::string s, Type* & t);

Socks

Jan 12 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Sandy | last post: by
12 posts views Thread by Mike | last post: by
13 posts views Thread by al.cpwn | last post: by
51 posts views Thread by Kuku | last post: by
8 posts views Thread by toton | last post: by
11 posts views Thread by asdf | last post: by
41 posts views Thread by Summercool | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.