随笔分类 - note_yanle
摘要:1 /* 最简单的窗口base.c */ 2 #include <gtk/gtk.h>//包括了 GTK+中所有的控件、变量、函数和结构的声明 3 int main ( int argc , char* argv[]) 4 { 5 //声明窗口控件的指针,GtkWidget是GTK+2.0控件类型
阅读全文
摘要:// gen generates integers in a separate goroutine and // sends them to the returned channel. // The callers of gen need to cancel the context once //
阅读全文
摘要:// gen generates integers in a separate goroutine and // sends them to the returned channel. // The callers of gen need to cancel the context once //
阅读全文
摘要:1 #include <iostream> 2 #include <string> 3 4 using namespace std; 5 6 class Base 7 { 8 }; 9 10 class Exception : public Base 11 { 12 int m_id; 13 str
阅读全文
摘要:1 #include<iostream> 2 using namespace std; 3 template 4 <typename T> 5 class Operator{ 6 7 public: 8 T add(T a,T b){ 9 return a + b; 10 } 11 T minus(
阅读全文
摘要:1 #include<iostream> 2 using namespace std; 3 class shape{//图形类 4 public: 5 virtual double area() = 0;//纯虚函数 6 }; 7 class rect:public shape{ 8 int ma;
阅读全文
摘要:1 #ifndef _51_2_H 2 #define _51_2_H 3 typedef void Demo; 4 typedef void Derived; 5 Demo* Demo_create(int i,int j); 6 int Demo_geti(Demo*pthis); 7 int
阅读全文
摘要:1 #include<iostream> 2 #include<string> 3 using namespace std; 4 class boss{ 5 public: 6 int fight(){ 7 int ret = 10; 8 cout << "boss::fight():ret=" <
阅读全文
摘要:1 #include<iostream> 2 #include<string> 3 using namespace std; 4 class parent{ 5 public: 6 int mi; 7 void add(int v){ 8 mi += v; 9 } 10 void add(int a
阅读全文
摘要:#include<iostream> 2 #include<string> 3 using namespace std; 4 class parent{ 5 protected: 6 int m_a; 7 int m_b; 8 public: 9 int m_c; 10 void set(int a
阅读全文
摘要:#include<iostream> 2 #include<string> 3 using namespace std; 4 class parent{ 5 protected: 6 int m_a; 7 int m_b; 8 public: 9 int m_c; 10 void set(int a
阅读全文
摘要:1 include<iostream> 2 #include<string> 3 using namespace std; 4 class parent{ 5 protected: 6 int mv; 7 public: 8 parent(){ 9 mv = 100; 10 } 11 int val
阅读全文
摘要:C++中存在将类对象转换成其他类型 语法: operator type(){} //无参数无返回值,type类型就是类对象将要转换成的类型 1 #include<iostream> 2 #include<string> 3 using namespace std; 4 class test{ 5 i
阅读全文
摘要:标准数据类型之间会进行 隐式类型的安全转换 转换规则如下: char→int→unsigned int →long→unsigned long→float→double ↓ short→int 1 #include<iostream> 2 #include<string> 3 using names
阅读全文
摘要:1#include<iostream> 2 using namespace std; 3 class test{ 4 int mvalue; 5 public: 6 test(int i){ 7 cout << "test(int i)=" << i << endl; 8 mvalue = i; 9
阅读全文
摘要:class test{ 2 int mvalue; 3 public: 4 test(int i){ 5 cout << "test(int i) =" << i << endl; 6 mvalue = i; 7 } 8 int value(){ 9 return mvalue; 10 } 11 t
阅读全文
摘要:#include<iostream> 2 using namespace std; 3 class test{ 4 int mvalue; 5 public: 6 test(int i){ 7 cout << "test(int i)=" << i << endl; 8 mvalue = i; 9
阅读全文
摘要:1 #include<iostream> 2 #include <stdio.h> 3 using namespace std; 4 class test{ 5 int mvalue; 6 public: 7 explicit test(int i=0){ //此处的explicit表明该构造函数需
阅读全文
摘要:1, #include<iostream> 2 2 #include<string> 3 3 using namespace std; 4 4 class test{ 5 5 int i; 6 6 public: 7 7 test(int i){ 8 8 cout << "test(int i)"
阅读全文
摘要:1 #include<iostream> 2 using namespace std; 3 class test{ 4 int mvalue; 5 public: 6 test(int i){ 7 mvalue = i; 8 } 9 int value(){ 10 return mvalue; 11
阅读全文