摘要: #include <iostream> using namespace std; class Animal { public: static int number; virtual ~Animal() { } }; class Dog:public Animal { public: static i 阅读全文
posted @ 2022-02-19 22:49 icefield817 阅读(81) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> using namespace std; class Point { private: int x; int y; public: Point() { }; friend istream& operator>> (istream & is,Point & pp 阅读全文
posted @ 2022-02-19 22:48 icefield817 阅读(71) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <string> #include <cstring> using namespace std; class MyString { char * p; public: MyString(const char * s) { if( s) { p 阅读全文
posted @ 2022-02-19 22:46 icefield817 阅读(96) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> using namespace std; class MyInt { int nVal; public: MyInt( int n) { nVal = n ;} MyInt& operator- (int n) { nVal -= n; return *thi 阅读全文
posted @ 2022-02-19 22:46 icefield817 阅读(78) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <string> using namespace std; static int n; static int* sumBloodArr; static int (*manBloodArr)[5]; const string manName[5 阅读全文
posted @ 2022-02-19 22:45 icefield817 阅读(71) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <string> using namespace std; class Base { public: int k; Base(int n):k(n) { } }; class Big { public: int v; Base b; Big( 阅读全文
posted @ 2022-02-19 22:44 icefield817 阅读(66) 评论(0) 推荐(0) 编辑
摘要: #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) 编辑
摘要: #include <iostream> using namespace std; void swap(int *& a, int *& b) { int * tmp = a; a = b; b = tmp; } int main() { int a = 3,b = 5; int * pa = & a 阅读全文
posted @ 2022-02-19 22:34 icefield817 阅读(28) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> using namespace std; class A { public: int x; int getX() { return x; } }; void swap(A & a,A & b) { int tmp = a.x; a.x = b.x; b.x = 阅读全文
posted @ 2022-02-19 22:31 icefield817 阅读(53) 评论(0) 推荐(0) 编辑