[Insight-developers] private constructor with argument Self
    Miller, James V (Research) 
    millerjv at crd.ge.com
       
    Thu Mar  3 16:29:49 EST 2005
    
    
  
Here is my take...
Any ITK class derived from itk::Object that is NOT abstract needs 
to have foo(const Self &) and operator=(const Self &) declared 
but not defined.
Basically, any concrete class derived from itk::Object needs to have 
these methods declared.  This keeps the user from calling the copy
constructor and operator= AND keeps the compiler from generating a 
default implementation.
Abstract classes do not need them since they cannot be instantiated.
This is also why abstract classes do not need itkNewMacro() calls.
Jim
-----Original Message-----
From: insight-developers-bounces at itk.org
[mailto:insight-developers-bounces at itk.org]On Behalf Of Stephen R.
Aylward
Sent: Thursday, March 03, 2005 3:23 PM
To: Insight-developers (E-mail)
Subject: [Insight-developers] private constructor with argument Self
Hi,
Question: When do I implement a private contructor that takes a const 
reference to self as an argument?
e.g.,
Class foo
  {
  public:
    stuff...
  private:
    foo(const Self &);
    void operator=(const Self &);
  }
Sometimes these functions are implemented in itk classes....sometimes 
not.   I thought I knew the answer...but...I guess I am 
wrong...Specifically, in ITK it doesn't appear to depend on whether or 
not there are local vars in the class...   I couldn't find anything on 
our web pages or in the software guide...
Thanks,
Stephen
-- 
===========================================================
Dr. Stephen R. Aylward
Associate Professor of Radiology
Adjunct Associate Professor of Computer Science and Surgery
http://caddlab.rad.unc.edu
aylward at unc.edu
(919) 966-9695
_______________________________________________
Insight-developers mailing list
Insight-developers at itk.org
http://www.itk.org/mailman/listinfo/insight-developers
    
    
More information about the Insight-developers
mailing list