By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 833 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

Basic C++ questions

P: n/a
1. How many types of copy constructor in C++?

2. Will compiler-generated copy constructor do bitwise or memberwise
copying?
Sep 28 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
webfan wrote:
1. How many types of copy constructor in C++?

2. Will compiler-generated copy constructor do bitwise or memberwise
copying?
Guessing from 2, the answer to 1 is "compiler-generated or
programmer-supplied."

The answer to 2 is "memberwise".

Is this for a quiz or something?

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
Sep 28 '06 #2

P: n/a
webfan wrote:
1. How many types of copy constructor in C++?
If you refer to possible signatures, then two.
2. Will compiler-generated copy constructor do bitwise or memberwise
copying?
The latter. What book are you reading that doesn't explain those
basic elements of the language?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Sep 28 '06 #3

P: n/a

1. How many types of copy constructor in C++?

2. Will compiler-generated copy constructor do bitwise or memberwise
copying?
Is homework of you?
Sep 29 '06 #4

P: n/a
Victor Bazarov wrote:
webfan wrote:
>1. How many types of copy constructor in C++?

If you refer to possible signatures, then two.
Actually, it can be more. You can have defaulted
args for the other parameters.
>
>2. Will compiler-generated copy constructor do bitwise or memberwise
copying?

The latter. What book are you reading that doesn't explain those
basic elements of the language?
Nothing trully works "bitwise" in C++. The smallest unit of
operation is a byte.
Sep 29 '06 #5

P: n/a
Ron Natalie wrote:
Victor Bazarov wrote:
>webfan wrote:
>>1. How many types of copy constructor in C++?

If you refer to possible signatures, then two.

Actually, it can be more. You can have defaulted
args for the other parameters.
>>
>>2. Will compiler-generated copy constructor do bitwise or memberwise
copying?

The latter. What book are you reading that doesn't explain those
basic elements of the language?
Nothing trully works "bitwise" in C++. The smallest unit of
operation is a byte.
I think & and | and ^ operators work bitwise in C++. That's why they
are called bitwise.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Sep 29 '06 #6

P: n/a
>>>
Nothing trully works "bitwise" in C++. The smallest unit of
operation is a byte.

I think & and | and ^ operators work bitwise in C++. That's why they
are called bitwise.
But they work on something no smaller than a char.

Actually, with bitfields you can get to smaller items than a char,
but in general bytes are the smallest entity.
Sep 29 '06 #7

P: n/a
Ron Natalie wrote:
Victor Bazarov wrote:
>webfan wrote:
[snip]
>>2. Will compiler-generated copy constructor do bitwise or memberwise
copying?

The latter. What book are you reading that doesn't explain those
basic elements of the language?
Nothing trully works "bitwise" in C++. The smallest unit of
operation is a byte.
I think, under the as-if rule, an implementation is allowed to copy,say, a
char or an unsigned int bitwise as long as it makes sure that at the end,
all bits have been copied :-)
Best

Kai-Uwe Bux
Sep 29 '06 #8

P: n/a
Ron Natalie wrote:
>
>>>>
Nothing trully works "bitwise" in C++. The smallest unit of
operation is a byte.


I think & and | and ^ operators work bitwise in C++. That's why they
are called bitwise.

But they work on something no smaller than a char.

Actually, with bitfields you can get to smaller items than a char,
but in general bytes are the smallest entity.
No bird is as small as a fly-bird. Actually, some fly-birds are as
small, but in general birds are bigger than fly-birds.
Oct 1 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.