摘要: #include <iostream> using namespace std; struct A { int v; A(int vv):v(vv) { } const A * getPointer() const { return this; } }; int main() { const A a 阅读全文
posted @ 2022-02-19 22:44 icefield817 阅读(32) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> using namespace std; class A { public: int i; A(int x) { i = x; } ~A() { cout << i << endl; } }; int main() { A a(1); A * pa = new 阅读全文
posted @ 2022-02-19 22:43 icefield817 阅读(37) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> using namespace std; class A { public: int val; A(int n):val(n) { } A():val(123){} A & GetObj() { return *this; } }; int main() { 阅读全文
posted @ 2022-02-19 22:43 icefield817 阅读(27) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <cstring> #include <cstdlib> using namespace std; class Complex { private: double r,i; public: void Print() { cout << r < 阅读全文
posted @ 2022-02-19 22:42 icefield817 阅读(71) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> using namespace std; class A { public: int val; A(int n):val(n) {} A():val(123){} A & GetObj() { return *this; } }; int main() { i 阅读全文
posted @ 2022-02-19 22:41 icefield817 阅读(66) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> using namespace std; class Sample { public: int v; Sample(){} Sample(int a):v(a){} Sample(const Sample& s) { v = s.v+2; } }; void 阅读全文
posted @ 2022-02-19 22:39 icefield817 阅读(61) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <string> #include <cstdio> #include <cstring> #include <sstream> #include <cstdlib> using namespace std; class Student { 阅读全文
posted @ 2022-02-19 22:38 icefield817 阅读(101) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <string> #include <cstdio> #include <cstring> #include <sstream> #include <cstdlib> using namespace std; class Student { 阅读全文
posted @ 2022-02-19 22:38 icefield817 阅读(67) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> using namespace std; int main() { int * a[] = { NULL,NULL, new int(123),new int[6] {1,1,1,1,1,456} }; *a[2] = 123; a[3][5] = 456; 阅读全文
posted @ 2022-02-19 22:36 icefield817 阅读(98) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> using namespace std; int & getElement(int * a, int i) { return a[i]; } int main() { int a[] = {1,2,3}; getElement(a,1) = 10; cout 阅读全文
posted @ 2022-02-19 22:35 icefield817 阅读(65) 评论(0) 推荐(0) 编辑