Hello for my friends in daniweb

class X
{
    public:
        virtual void function( ) = 0;
    protected:
        int x,y;
        color cl;
        X-type type;
        char a;
};
class X is abstract class.
class Y : public X
{
    private:
        int counter;
}

class Z : public X
{
    private:
        int h, s;
}

-----------------------------
i want to copy object of derived class to base class
how can i overload operator = that copy private member of derived class in base class;
example:

x* arr[10][10];
arr[2][2] = new Y( constructor of class Y );
arr[3][2] = arr [2][2];

that operator = just copy counter, cl, type, a of arr[2][2] to arr[3][2]
and how i can initialize to x=3,y=2 of arr[3][2] or x=2, y=2 of arr[2][2]
example2:

arr[5][5] = new Z( constructr of class Z );
arr[a][b] = arr[5][5];

that a,b variables that user enter
how i overload operator = for these 3 classes that copy priavate member of derived class 1( Y ) to

derived class2( Z ) or copy derived class to base class

i can't find topic operator overloading with inheritance in the books if you
know books that describe his topic pleas introduce me that book
thank's

class X
{
	public:
		virtual void function( ) = 0;
	protected:
		int x,y;
		color cl;
		X-type type;
		char a;
};
class X is abstract class.
----------------------------
class Y : public X
{
	private:
		int counter;
}

class Z : public X
{
	private:
		int h, s;
}

-----------------------------
X* arr[10][10];
arr[0][1] = new Y( costructor of class Y );
arr[5][6] = arr[0][1];

i want overload perator = for above example
left side of operator = is pointer of base class that is not point any object or free
and right side of operator = is pointer to derived class object.
i want copy some data member of right side of operator = to left side operator =
example:
arr[5][6]=arr[0][1];
copy color cl, color cl,char a of the arr[0][1] to arr[5][6]
and x,y of arr[5][6] are---> x=5, y=6
and then i want to arr[0][1] = 0 or otherhand
arr[0][1] ---> x=0, y=1
cl == ???, type = ???, a=???

how can i do this?
please help me
thx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.