Thread: copy constructor doesn't invoke

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #9
    Registered User gavra's Avatar
    Join Date
    Jun 2008
    Posts
    265
    In RBNode:
    Code:
    virtual RBNode & operator=(const RBNode & rhs);
    
    RBNode & RBNode::operator=(const RBNode & rhs)
    {
    	this->left = rhs.left;
    	this->right = rhs.right;
    	this->parent = rhs.parent;
    	this->color = rhs.color;
    	
    	return *this;
    }
    I put a breakpoint there and it doesn't stop. It doesn't get there @_@
    any ideas?

    and yes I am sure there is an assignment in my code, for example, here:
    Code:
    RBNode* RedBlackTree::Delete(RBNode* z)
    {
    	RBNode *y, *x;
    
    	if (z->left == this->nil || z->right == this->nil)
    		y = z;
    	else
    		y = TreeSuccessor(z);
    	if (y->left != this->nil)
    		x = y->left;
    	else
    		x = y->right;
    	x->parent = y->parent;
    	if (y->parent == this->nil)
    	{
    		this->root = x;
    	}
    	else if (y == y->parent->left)
    	{
    		y->parent->left = x;
    	}
    	else
    		y->parent->right = x;
    	if (y != z)
    	{
    		y->CopyTo(z);
    	}
    	if (y->color == BLACK)
    		this->DeleteFixup(x);
    	return y;
    }
    Even though the pointers reffer to derived classes (such as BookNode) it still has to invoke the RBNode:perator = since the refferences declared as RBNode... (right?)
    Last edited by gavra; 06-07-2013 at 07:32 AM.
    gavra.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Copy constructor and new
    By Memloop in forum C++ Programming
    Replies: 10
    Last Post: 09-13-2009, 10:23 AM
  2. Copy Constructor
    By noobcpp in forum C++ Programming
    Replies: 3
    Last Post: 07-01-2007, 06:29 AM
  3. Copy constructor
    By dude543 in forum C++ Programming
    Replies: 26
    Last Post: 01-26-2006, 05:35 PM
  4. what is copy constructor?
    By Tonyukuk in forum C++ Programming
    Replies: 4
    Last Post: 12-10-2002, 05:54 PM
  5. copy constructor
    By ygfperson in forum C++ Programming
    Replies: 6
    Last Post: 03-05-2002, 06:55 PM