public Dog ( Dog dog )
{
this.weight = dog.weight;
this.colour = dog.colour;
this.bites = dog.bites;
}
/**
* Using copy constructor in a subclass.
*/
public Dalmation ( Dog dog, int spotCount )
{
this( dog );
this.spotCount = spotcount;
}
/**
* promote a Dog to a Dalmatian
*/
Dalmatian dalmatian = new Dalmatian( dog, 42 );
/**
* Demote a Dalmatian back to a dog
*/
Dog dog = new Dog ( dalmatian );
/**
* proposed shorthand for writing a copy constructor
* instead of listing all the fields. Implemented as
* a block move, very fast, similar to clone();
*/
public Dog ( Dog dog )
{
clone( dog );
}