The simple answer is to get out of the habit of using arrays, and learn to use STL container classes (such as std::vector). They make this sort of thing so much easier, because they already have sensible operators, constructors and methods defined.
a1=a2 // shallow copy in this case is safe.
but in case class A has a data member such as a pointer i.e int *data in that case simple
assignment will be dangerous in that case you will use Copy Ctor as we not only want to copy simple data members but also the data which is pointed by int *data so a deep copy is required and Copy Ctor serves the purpose
In an assignment like this.
a = b; // same type with array as member.
if object a array is smaller than object b array. Should it error ?
if they (data members) are indeed arrays with different sizes then a and b have different types.:)
Of cource you may define the copy assignment operator. In this case you should write copying of the arrays yourself.