- void UnShare();
-};
-
-
-// implementation
-
-MyCar::MyCar( int price )
-{
- m_data = new MyCarRefData;
- m_data.get()->SetPrice( price );
-}
-
-MyCar::MyCar( const MyCar& car )
-{
- m_data.reset( car.m_data.get() );
-}
-
-bool MyCar::operator == ( const MyCar& car ) const
-{
- if (m_data.get() == car.m_data.get()) return true;
-
- return (*m_data.get() == *car.m_data.get());
-}
-
-void MyCar::SetPrice( int price )
-{
- UnShare();
-
- m_data.get()->SetPrice( price );
-}
-
-int MyCar::GetPrice() const
-{
- return m_data.get()->GetPrice();
-}
-
-void MyCar::UnShare()
-{
- if (m_data.get()->GetCount() == 1)
- return;