构造函数
![](https://img2018.cnblogs.com/blog/1488547/201810/1488547-20181031215944622-1335712557.png)
public class Vector3 { public float x,y,z,length; public Vector3() { Console.WriteLine("Vector被调用了"); } public Vector3(float x,float y,float z){ this.x=x; this.y=y; this.z=z; length=Length(); } public float Length(){ return(float)Math.Sqrt(x*x+y*y+z*z); } } } // using System; namespace c构造函数 { class Program { public static void Main(string[] args) { Vector3 v1=new Vector3(1,1,1); Console.WriteLine("Hello World!"); // TODO: Implement Functionality Here Console.Write("Press any key to continue . . . "); Console.ReadKey(true); } } }