Created
August 7, 2013 09:37
-
-
Save xingfuqiu/6172625 to your computer and use it in GitHub Desktop.
C++:孙鑫教程Lesson2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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