Menu

Copy ctor and assignment?

2001-11-03
2001-11-05
  • Shane Baker

    Shane Baker - 2001-11-03

    I was looking through the code considering how I might implement runtime configuration changes and I notice that Category does not declare a copy constructor or assignment operator.  Therefore, the compiler will generate them and it further appears to me that this would not be safe at all based on the destructor.

    Am I missing something or should these be declared private and left unimplemented?  I have been creating Category members that have been initialized with the copy constructor and didn't know that it was unsafe until now.  I had just assumed that there was a reference counting scheme.

     
    • Bastiaan Bakker

      Bastiaan Bakker - 2001-11-05

      Hi Shane,

      You're absolutely right: a private copy constructor and assignment operator to prevent copying of Category are missing. I've added them now. If you see any more of these, please let me know!
      I'm more used to Java where not writing code is not a crime... :-)

      Cheers,

      Bastiaan

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.