illegal indirections

K

Kev

Greetings all :eek:)

Pardon if my quickie code isnt exactly right. This is the classic 'you cant
do that' reference to a reference problem:

I am trying to avoid passing the class itself around... and from using
pointers. To get around the problem here is what I did. I havent been able
to really test this throughly as Im not ready to use it. But I am not
receiving any compile errors.

myclass a;
function1(a);

function1(myclass &b)
{
function2(myclass &b);
}

function2(myclass *c)
{
}

In function1 am I passing a pointer to 'a' to function2... without making
any duplicates of it?

cheers
 
G

Gianni Mariani

Kev said:
Greetings all :eek:)

Pardon if my quickie code isnt exactly right. This is the classic 'you cant
do that' reference to a reference problem:

I am trying to avoid passing the class itself around... and from using
pointers. To get around the problem here is what I did. I havent been able
to really test this throughly as Im not ready to use it. But I am not
receiving any compile errors.

myclass a;
function1(a);

function1(myclass &b)
{
function2(myclass &b);
}

function2(myclass *c)
{
}

In function1 am I passing a pointer to 'a' to function2... without making
any duplicates of it?

Yes. c will be a pointer to a.
 
O

Old Wolf

Kev said:
Greetings all :eek:)


myclass a;
function1(a);

You can't have non-declaration statements at file scope.
I'll assume that those 2 lines were in some function,
but the following code is back at file scope.
function1(myclass &b)
{
function2(myclass &b);

That's a syntax error. Perhaps you meant:

function2(&b);

which would do the same as function2(&a) instead of function1(a).
 
K

Kev

That's a syntax error. Perhaps you meant:

function2(&b);

which would do the same as function2(&a) instead of function1(a).


Havent read posts here in about a week. Yes you are correct... which is how
it ended up in the end.

Thank you :eek:)

Now Im trying to figure out why a simple fout.close() would cause an access
error
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top