Re: C++ constructors.

2009-05-13 Thread Alastair Houghton
On 13 May 2009, at 15:16, Тимофей Даньшин wrote: Hi there. Here is a C++ constructor that is said to work on Windows (i.e., the guy who wrote it says it works on Win), but doesn't work on Mac. Is there a way to fix it, except by replacing it with a "copy" method? Cbyte1::Cbyte1 (Cbyte1 &v

Re: C++ constructors.

2009-05-13 Thread Jesper Storm Bache
Your copy constructor is atypical because the argument is not const (or a non reference). You could change it to be: Cbyte1::Cbyte1 (const Cbyte1 &val) Secondly, it looks like your class is a template. In that case you may either want: template class Cbyte1 { Cbyte1 (const

Re: C++ constructors.

2009-05-13 Thread Luca Ciciriello
in addition to this copy-constructor, had you provided a default constructor? in addition try to using the copy constructor with const parameter has show below. Cbyte1::Cbyte1 (const Cbyte1 &val) { // SOMETHING } Luca. ___

C++ constructors.

2009-05-13 Thread Тимофей Даньшин
Hi there. Here is a C++ constructor that is said to work on Windows (i.e., the guy who wrote it says it works on Win), but doesn't work on Mac. Is there a way to fix it, except by replacing it with a "copy" method? Cbyte1::Cbyte1 (Cbyte1 &val) { m_size = val.m_size; if (m_s