class Car
    {
       public string description;
        private unit nWheels;
        static Car(string model,unit nwheels)
        {
            this.description = description;
            this.nWheels = nwheels;
        
        }
        static Car(string model)
        {
            this.description = description;
            this.nWheels = 4;        }
       //etc.
这是书上讲关于从构造函数中调用其他的构造函数(有书可以看下书p86页)这里的model是什么东西啊  怎么在构造函数中又出现了description这个变量了啊 还有unit是什么类型啊~查过MSDN了 都没找到这个东西  看的我云里雾里的 谁能点化下哈~~

解决方案 »

  1.   

    model是你car类的一个构造函数的参数:static Car(string model,unit nwheels) 
    description是你在类中声明的一个变量:public string description
    uint 是无符号 32 位整数;范围为0 到 4294967295
      

  2.   

    构造函数中调用其他的构造函数
    ==
    严格地来说是构造函数初始化器
    这里的model是什么东西啊  怎么在构造函数中又出现了description这个变量了啊
    ==
    楼主还没明白构造函数的意思,在本例中是使用参数初始化类Car还有unit是什么类型啊
    ==
    无符号整形
      

  3.   

    uint = System.UInt32System.UInt32 值类型表示值介于 0 到 4,294,967,295 之间的无符号整数。
      

  4.   

    应该是uint吧,还有应该是“this.description = model”吧
      

  5.   

    ...unit是我看错了~~~uint  丢人了~~
    可是那个model 你们好像还是没有回答我啊
    明明在构造函数的里只有两个参数 一个是 string model,还一个是uint nwheels
    那么this.description=description中的description是从哪里冒出来的啊  是不是写错了应该是this.description=model啊? 
      

  6.   


        class 车 
        { 
            public string 描述; 
            private unit 轮子数; 
            static 车 (string 款式,unit 轮子数) 
            { 
                this.描述 = 款式; 
                this.轮子数= 轮子数; 
            
            } 
            static 车 (string 款式) 
            { 
                this.描述= 款式; 
                this.轮子数= 4;         }
        } 没看见从构造函数中调用其他的构造函数啊,只不过是重载了构造函数,有2个不同参数的构造函数而已么,第2个车轮数就默认4个了
      

  7.   

    书本上的错误,unit 单位(没有这种基本类型,除非自己构建一个类); uint 无符号的整型(基本类型)其他的问题别人已经说了。
      

  8.   

    对这是书的错误,可以看看英文版的勘误表,这是网址
    http://www.wrox.com/WileyCDA/WroxTitle/Professional-C-2005.productCd-0764575341,descCd-ERRATA.html
    这是更正的内容
     98-99 Error in Text
    All instances of 
    string model
    should be
    string description  
      

  9.   

    构造函数可以static, 静态构造函数没有访问修饰符!!!!!