I am using some of the vendor libraries in my code. Some of the codes are like below. I see it uses circular dependency between classes.I am unable to understand what is the reason of making the copy constructor and assignment as private. One of the static code analysis tool throws violation as "Avoid classes using 'new' to allocate instances but not defining a copy constructor."
class Parent;
class Child{
public:
Child(Parent& parent):mrParent(parent);
private:
Parent& mrParent;
};
class Parent{
public:
Parent();
~Parent();
//other declarations
Child* child;
private:
//copy and assignment are not allowed. Explicitly declaring private
Parent(const Parent&)
Parent& operator=(const Parent&);
};