Private copy constructor used when making a copy of this object : Constructor : Class C# Examples


C# Examples » Class » Constructor »

 

Private copy constructor used when making a copy of this object









    
using  System;

public  sealed  class  Dimensions  :  ICloneable
{
        public  Dimensions(  long  width,  long  height  )  {
                this.width  =  width;
                this.height  =  height;
        }

        private  Dimensions(  Dimensions  other  )  {
                this.width  =  other.width;
                this.height  =  other.height;
        }

        public  object  Clone()  {
                return  new  Dimensions(this);
        }
        
        private  long  width;
        private  long  height;
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Constructor