Let us have a complex class with two double data member.
If I would like to copy it by reference
that means that I have two copy one or two pointers?

Recommended Answers

All 2 Replies

In C++ term of reference or in general ?

You can do this :

Complex& Complex::getClass() { return *this; }

That way, you get the Complex class as a reference in terms of the reference operator.

No, my question is not the syntax!
My question is about the compiling and the speed!
So if I have a function:

void function(complex c);

or

void function(complex& c);

works faster?
In the second case, only one or two pointer are copied?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.