Oh, I see.
If I define a copy ctor explicitly in derived class without calling the
copy ctor of base class in initializer list, the compiler will call the
default ctor of base class implicitly.
But if I do not define the copy ctor in derived class, the compiler
will generate a copy ctor which will call the copy ctor of base class
at first.
That's the difference.
However, as for copy assignment, the compiler will implicitly generate
the following fuction:
HomeForSale& operator=(const HomeForSale& rhs)
{
Uncopyable:

perator=(rhs);
}
The calling of function in base class is where the compile error comes
from.
Sylvester Hesp wrote:
> The generated copy ctor of the derived class will call the copy ctor of it's
> base. Which makes sense, the derived class is only responsible for copying
> it's own members, and any copying that needs to be done inside the base
> class is the responsibility for the base class itself. So in your example,
> the compiler will implicitely generate the following function:
>
> HomeForSale(const HomeForSale & other) : Uncopyable(other)
> {
> }
>
> But the copy ctor of Uncopyable is inaccessible for HomeForSale members (as
> it's private to Uncopyable and HomeForSale isn't a friend of Uncopyable), so
> you'll get a compile error.
>
> Exactly the same goes for assignment operators.
>
> - Sylvester
>
> "campos" <> wrote in message
> news: oups.com...
> > Thanks Sylvester,
> >
> > What I am puzzled with is that the author says "the compiler-generated
> > versions of these functions will try to call their base class
> > counterparts, and those calls will be rejected,
> > because the copying operations are private in the base class."
> >
> > I don't know why the counterparts in base class will be called.
> >
> >
> > Sylvester Hesp wrote:
> >> "campos" <> wrote in message
> >> news: oups.com...
> >> > "Effective C++ 3rd Edition" Item 6, P39
> >> > -------------------------------------------------------
> >> > This works, because compilers will try to generate a copy constructor
> >> > and a copy assignment operator if anybody - even a member or friend
> >> > function - tries to copy a HomeForSale object. As Item 12 explains,
> >> > the compiler-generated versions of these functions will try to call
> >> > their base class counterparts, and those calls will be rejected,
> >> > because the copying operations are private in the base class.
> >> > -------------------------------------------------------
> >> >
> >> > I tried it in VC7.0 and it did come out with a compiled error instead
> >> > of a link error.
> >> >
> >> > Thanks in advance!
> >> >
> >>
> >> So? A compile error is just what you'd expect to get, right? The author
> >> says
> >> nothing about link errors (you will get link errors when someone that's
> >> both
> >> a friend of Base _and_ Derived (or is a member of one and a friend of the
> >> other) tries to copy the object)
> >>
> >> - Sylvester
> >