#include<string>
class Bitmap {};
class Widget {
Widget& operator=(const Widget& rhs);
private:
Bitmap* pb;
};
Widget& Widget::operator=(const Widget& rhs)
{
Bitmap* pOrig = pb;
pb = new Bitmap(*rhs.pb);
delete pOrig;
return *this;
}
void logCall(const std::string& funcName);
class Date{};
class Customer
{
public:
Customer();
~Customer();
Customer(const Customer& rhs);
Customer& operator=(const Customer& rhs);
private:
std::string name;
Date lasttransaction;
};
Customer::Customer()
{
}
Customer::~Customer()
{
}
Customer::Customer(const Customer& rhs):name(rhs.name)
{
logCall("Customer copy constructor");
}
Customer& Customer::operator=(const Customer& rhs)
{
logCall("Custoer copy assigment operator");
name = rhs.name;
return *this;
}
class PriorityCustomer :public Customer {
public:
PriorityCustomer& operator=(const PriorityCustomer& rhs);
PriorityCustomer(const PriorityCustomer& rhs);
private:
int priority;
};
int main()
{
Widget wid;
return 0;
}
class Investment {};
Investment* createInvestment();
void f()
{
Investment* pInv = createInvestment();
delete pInv;
}
PriorityCustomer& PriorityCustomer::operator=(const PriorityCustomer& rhs)
{
logCall("PriorityCustomer copy assignment");
Customer::operator=(rhs);
priority = rhs.priority;
return *this;
}
PriorityCustomer::PriorityCustomer(const PriorityCustomer& rhs):priority(rhs.priority),Customer(rhs)
{
logCall("PriorityCusomer copy constructor");
}