65,211
社区成员
发帖
与我相关
我的任务
分享
#include <iostream.h>
class com
{
int x,y,c;
public:
com(int i=0,int j=0);
void f();
};
void com::f()
{
cout <<x <<" "<<y <<endl;
c++;
}
void com::f() const
{cout < <x < <” “ < <y < <endl;
c++;
}
#include <iostream.h>
class com
{
int x,y,c;
public:
com(int i=0,int j=0);
void f() const;
};
void com::f() const
{
cout <<x <<" "<<y <<endl;
c++;
}
#include <iostream.h>
class sp
{
public:
sp(int a=0, int b=1);
void disp();
private:
int x,y;
};
sp::sp(int a,int b)
{
x=a;
y=b;
}
void sp::disp()
{
cout<<"x= "<<x<<",y="<<y<<endl;
}
#include <iostream.h>
class point
{
public:
int x1,x2;
public:
point(int x,int y):x1(x),x2(y){}
};
void main()
{
point data(5,5);
cout <<data.x1 <<endl;
cout <<data.x2 <<endl;
}