Re: Make assign illegal for class
- From: "Doug Harrison [MVP]" <dsh@xxxxxxxx>
- Date: Sat, 20 Aug 2005 15:09:10 -0500
On Sat, 20 Aug 2005 21:05:20 +0100, "Mark Randall"
<markyr@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>Hi,
>
>Is there any way to explicitly make = or copy construction illegal for a
>given class? I have several that are most complex and will at no point ever
>need to be copied.
>
>For integrity purposes, is there any way to disable the copy all together
>and generate a warning? (I was thinking of having a home made copy
>constructor but I have no idea about generating a compile error inside it).
Declare them private but don't ever define them, e.g.
class X
{
private:
// Copyguard
X(const X&);
void operator=(const X&);
};
--
Doug Harrison
VC++ MVP
.
- References:
- Make assign illegal for class
- From: Mark Randall
- Make assign illegal for class
- Prev by Date: Make assign illegal for class
- Next by Date: Re: Make assign illegal for class
- Previous by thread: Make assign illegal for class
- Next by thread: Re: Make assign illegal for class
- Index(es):
Relevant Pages
|