Skip to content

Instantly share code, notes, and snippets.

@xingfuqiu
Created August 7, 2013 09:37
Show Gist options
  • Save xingfuqiu/6172625 to your computer and use it in GitHub Desktop.
Save xingfuqiu/6172625 to your computer and use it in GitHub Desktop.
C++:孙鑫教程Lesson2
#include <iostream>
using namespace std;
class Point
{
public:
int x;
int y;
/**
void Init()
{
x = 5;
y = 5;
}
**/
//构造函数
Point(int a, int b)
{
x = a;
y = b;
}
//析构函数
~Point()
{
x = 0;
y = 0;
}
void output()
{
cout << x << endl << y << endl;
}
};
int main(int argc, char const *argv[])
{
Point pt(23, 43);
//pt.Init();
pt.output();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment