直接手工在代码处的类的构造函数那边写上构造函数的参数,编译不能通过,why?

解决方案 »

  1.   

    比如说:
    #include <iostream.h>class point {
    int x,y;
    public;
    point(int a, int b)
    {x=a; y=b}
    void print()
    { cout << x << " " << y << endl;}
    };main()
    {
    int input1;
    cout << "test program! " << ":"<< endl;
    cin >> input1;
    cout << "input number is :" << input1 << endl;
    ...
      

  2.   

    不要动它,在家一个不好吗
    point();
    point(int a,int b)
    {
       x=a;
       y=b;
    }
      

  3.   


    把 public 后面的那个 ";" 改成 ":"
      

  4.   

    是这样的:
      我们新建一个win32 console应用程序,选择简单的.
      工程名为my
      在Class View中右键选择"New class",新建一个类叫做point
      然后到FileView中的Header Files的point.h文件中:
      class point  
     {
      public:
    point(int a, int b);//int a, int b是手工增加
    virtual ~point();};只这样的操作编译却不能通过!!!why?
      

  5.   

    freeclick(自由点击):
    public后是 :这是我写错了。sorry!
      

  6.   

    构造函数不能是 online的。
      

  7.   

    iicup(双杯献酒) :
    那要怎么做?请指教!
      

  8.   

    class point  
     {
      public:
    point(int a, int b);//int a, int b是手工增加
    virtual ~point();};point::point(int a,int b)
    {
     x=a;
     y=b;
    }在使用的时候:(定义对象)
    point p(100,200);