Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old September 28th, 2006, 10:05 PM
webfan
Guest
 
Posts: n/a
Default Basic C++ questions

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

2. Will compiler-generated copy constructor do bitwise or memberwise
copying?


  #2  
Old September 28th, 2006, 10:05 PM
Phlip
Guest
 
Posts: n/a
Default Re: Basic C++ questions

webfan wrote:
Quote:
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!!!


  #3  
Old September 28th, 2006, 10:25 PM
Victor Bazarov
Guest
 
Posts: n/a
Default Re: Basic C++ questions

webfan wrote:
Quote:
1. How many types of copy constructor in C++?
If you refer to possible signatures, then two.
Quote:
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


  #4  
Old September 29th, 2006, 08:55 AM
Gernot Frisch
Guest
 
Posts: n/a
Default Re: Basic C++ questions


Quote:
1. How many types of copy constructor in C++?
>
2. Will compiler-generated copy constructor do bitwise or memberwise
copying?
Is homework of you?


  #5  
Old September 29th, 2006, 12:05 PM
Ron Natalie
Guest
 
Posts: n/a
Default Re: Basic C++ questions

Victor Bazarov wrote:
Quote:
webfan wrote:
Quote:
>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.
Quote:
>
Quote:
>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.
  #6  
Old September 29th, 2006, 01:05 PM
Victor Bazarov
Guest
 
Posts: n/a
Default Re: Basic C++ questions

Ron Natalie wrote:
Quote:
Victor Bazarov wrote:
Quote:
>webfan wrote:
Quote:
>>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.
>
Quote:
>>
Quote:
>>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


  #7  
Old September 29th, 2006, 01:15 PM
Ron Natalie
Guest
 
Posts: n/a
Default Re: Basic C++ questions

Quote:
Quote:
Quote:
>>>
>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.
  #8  
Old September 29th, 2006, 01:15 PM
Kai-Uwe Bux
Guest
 
Posts: n/a
Default Re: Basic C++ questions

Ron Natalie wrote:
Quote:
Victor Bazarov wrote:
Quote:
>webfan wrote:
[snip]
Quote:
Quote:
Quote:
>>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
  #9  
Old October 1st, 2006, 02:55 PM
Someone
Guest
 
Posts: n/a
Default Re: Basic C++ questions

Ron Natalie wrote:
Quote:
>
Quote:
Quote:
>>>>
>>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.
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles