Пример #1
0
        //{return $"X = {X}, Y = {Y}";}
        public object Clone() // => this.MemberwiseClone();
        {
            var clPoint = (Point)MemberwiseClone();
            var newdesc = new PointDescription();

            newdesc.PetName = desc.PetName;
            clPoint.desc    = newdesc;
            return(clPoint);
        }
Пример #2
0
        public object Clone()
        {
            Point newPoint = (Point)this.MemberwiseClone();

            PointDescription currentDesc = new PointDescription();

            currentDesc.PetName = this.desc.PetName;
            newPoint.desc       = currentDesc;
            return(newPoint);
        }
Пример #3
0
        // Return a copy of the current object
        public object Clone()
        {
            // First get a shallow copy
            Point newPoint = (Point)this.MemberwiseClone();

            // Clone the reference vars
            PointDescription currentDesc = new PointDescription();

            currentDesc.PetName = this.desc.PetName;
            newPoint.desc       = currentDesc;
            return(newPoint);
        }
Пример #4
0
        // Return a copy of the current object.
        public object Clone()
        {
            // First get a shallow copy.
            Point newPoint = (Point)this.MemberwiseClone();

            //Then fill in the gaps.
            PointDescription currentDesc = new PointDescription();

            currentDesc.PetName = this.desc.PetName;
            newPoint.desc       = currentDesc;
            return(newPoint);
        }