亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? chap23.lst

?? Borland C++ Builder The Complete Reference 例程源代碼
?? LST
字號:
listing 1
class X { 
  int i; 
  int j; 
public: 
  void get_ij(); 
  void put_ij(); 
} ; 
 
class Y : public X { 
  int k; 
public: 
  int get_k(); 
  void make_k(); 
} ;

listing 2
class X { 
protected: 
  int i; 
  int j; 
public: 
  void get_ij(); 
  void put_ij(); 
} ; 
 
class Y : public X { 
  int k; 
public: 
  int get_k(); 
  void make_k(); 
} ;

listing 3
class my_class { 
protected: 
  int i; 
  int j; 
public: 
  void f1(); 
  void f2(); 
protected: 
  int a; 
public: 
  int b; 
} ;

listing 4
#include <iostream> 
using namespace std; 
 
class X { 
protected: 
  int i; 
  int j; 
public: 
  void get_ij() { 
    cout << "Enter two numbers: "; 
    cin >> i >> j; 
  } 
  void put_ij() { cout << i << " " << j << "\n"; } 
} ; 
 
// In Y, i and j of X become protected members. 
class Y : public X { 
  int k; 
public: 
  int get_k() { return k; } 
  void make_k() { k = i*j; } 
} ; 
 
/* Z has access to i and j of X, but not to 
   k of Y, since it is private. */ 
class Z : public Y { 
public: 
  void f(); 
} ; 
 
// i and j are accessible here 
void Z::f() 
{ 
  i = 2; // ok 
  j = 3; // ok 
} 
 
int main() 
{ 
  Y var; 
  Z var2; 
 
  var.get_ij(); 
  var.put_ij(); 
 
  var.make_k(); 
  cout << var.get_k(); 
  cout << "\n"; 
 
  var2.f(); 
  var2.put_ij(); 
 
  return 0; 
}

listing 5
#include <iostream> 
using namespace std; 
 
class X { 
protected: 
  int i; 
  int j; 
public: 
  void get_ij() { 
    cout << "Enter two numbers: "; 
    cin >> i >> j; 
  } 
  void put_ij() { cout << i << " " << j << "\n"; } 
} ; 
 
// Now, i and j are converted to private members of Y. 
class Y : private X { 
  int k; 
public: 
  int get_k() { return k; } 
  void make_k() { k = i*j; } 
} ; 
 
/* Because i and j are private in Y, they 
   cannot be inherited by Z. */ 
class Z : public Y { 
public: 
  void f(); 
} ; 
 
// This function no longer works. 
void Z::f() 
{ 
//  i = 2;  i and j are no longer accessible 
//  j = 3; 
} 
 
int main() 
{ 
  Y var; 
  Z var2; 
 
//  var.get_ij();  no longer accessible 
//  var.put_ij();  no longer accessible 
 
  var.make_k(); 
  cout << var.get_k(); 
  cout << "\n"; 
 
  var2.f(); 
//  var2.put_ij();  no longer accessible 
 
  return 0; 
}

listing 6
#include <iostream> 
using namespace std; 
 
class Base { 
public: 
  Base() { cout << "\nBase created\n"; } 
}; 
 
class D_class1 : public Base { 
public: 
  D_class1() { cout << "D_class1 created\n"; } 
}; 
 
int main() 
{ 
  D_class1 d1; 
 
  // do nothing but execute constructors 
  return 0; 
}

listing 7
#include <iostream> 
using namespace std; 
 
class Base { 
public: 
  Base() { cout << "\nBase created\n"; } 
  ~Base() { cout << "Base destroyed\n\n"; } 
}; 
 
class D_class1 : public Base { 
public: 
  D_class1() { cout << "D_class1 created\n"; } 
  ~D_class1() { cout << "D_class1 destroyed\n"; } 
}; 
 
int main() 
{ 
  D_class1 d1; 
 
  cout << "\n"; 
 
  return 0; 
}

listing 8
#include <iostream> 
using namespace std; 
 
class Base { 
public: 
  Base() { cout << "\nBase created\n"; } 
  ~Base() { cout << "Base destroyed\n\n"; } 
}; 
 
class D_class1 : public Base { 
public: 
  D_class1() { cout << "D_class1 created\n"; } 
  ~D_class1() { cout << "D_class1 destroyed\n"; } 
}; 
 
class D_class2 : public D_class1 { 
public: 
  D_class2() { cout << "D_class2 created\n"; } 
  ~D_class2() { cout << "D_class2 destroyed\n"; } 
}; 
 
int main() 
{ 
  D_class1 d1; 
  D_class2 d2; 
 
  cout << "\n"; 
 
  return 0; 
}

listing 9
#include <iostream> 
using namespace std; 
 
class X { 
protected: 
  int a; 
public: 
  void make_a(int i) { a = i; } 
}; 
 
class Y { 
protected: 
  int b; 
public: 
  void make_b(int i) { b = i; } 
} ; 
 
// Z inherits both X and Y 
class Z : public X, public Y { 
public: 
  int make_ab() { return a*b; } 
} ; 
 
int main() 
{ 
  Z i; 
 
  i.make_a(10); 
  i.make_b(12); 
  cout << i.make_ab(); 
 
  return 0; 
}

listing 10
#include <iostream> 
using namespace std; 
 
class X { 
protected: 
  int a; 
public: 
  X() { 
    a = 10; 
    cout << "Initializing X\n"; 
  } 
}; 
 
class Y { 
protected: 
  int b; 
public: 
  Y() { 
    cout << "Initializing Y\n"; 
    b = 20; 
  } 
} ; 
 
// Z inherits both X and Y 
class Z : public X, public Y { 
public: 
  Z() { cout << "Initializing Z\n"; } 
  int make_ab() { return a*b; } 
} ; 
 
int main() 
{ 
  Z i; 
 
  cout << i.make_ab(); 
 
  return 0; 
}

listing 11
#include <iostream> 
using namespace std; 
 
class X { 
protected: 
  int a; 
public: 
  X(int i) { a = i; } 
}; 
 
class Y { 
protected: 
  int b; 
public: 
  Y(int i) { b = i; } 
} ; 
 
// Z inherits both X and Y 
class Z : public X, public Y { 
public: 
  /* Initialize X and Y via Z's constructor. 
     Notice that Z does not actually use x or y 
     itself, but it could, if it so chooses. */ 
  Z(int x, int y) : X(x), Y(y) 
  { 
    cout << "Initializing\n"; 
  } 
  int make_ab() { return a*b; } 
} ; 
 
int main() 
{ 
  Z i(10, 20); 
 
  cout << i.make_ab(); 
 
  return 0; 
}

listing 12
B_class *p;   // pointer to object of type B_class 
B_class B_ob; // object of type B_class 
D_class D_ob; // object of type D_class

listing 13
p = &B_ob; // p points to object of type B_class 
 
p = &D_ob; /* p points to object of type D_class, 
              which is an object derived from B_class. */

listing 14
// Using pointers on derived class objects. 
 
#include <iostream> 
#include <cstring> 
using namespace std; 
 
class B_class { 
  char name[80]; 
public: 
  void put_name(char *s) { strcpy(name, s); } 
  void show_name() { cout << name << " "; } 
} ; 
 
class D_class : public B_class { 
  char phone_num[80]; 
public: 
  void put_phone(char *num) { 
    strcpy(phone_num, num); 
  } 
  void show_phone() { cout << phone_num << "\n"; } 
}; 
 
int main() 
{ 
  B_class *p; 
  B_class B_ob; 
 
  D_class *dp; 
  D_class D_ob; 
 
  p = &B_ob;  // address of base 
 
  // Access B_class via pointer. 
  p->put_name("Thomas Edison"); 
 
  // Access D_class via base pointer. 
  p = &D_ob; 
  p->put_name("Albert Einstein"); 
 
  // Show that each name went into proper object. 
  B_ob.show_name(); 
  D_ob.show_name(); 
  cout << "\n"; 
 
  /* Since put_phone and show_phone are not part of the 
     base class, they are not accessible via the base 
     pointer p and must be accessed either directly, 
     or, as shown here, through a pointer to the 
     derived type. 
  */ 
  dp = &D_ob; 
  dp->put_phone("555 555-1234"); 
  p->show_name(); // either p or dp can be used in this line 
  dp->show_phone(); 
 
  return 0; 
}

listing 15
((D_class *)p)->show_phone();

listing 16
// A short example that uses virtual functions. 
#include <iostream> 
using namespace std; 
 
class Base { 
public: 
  virtual void who() { // specify a virtual function 
    cout << "Base\n"; 
  } 
}; 
 
class first_d : public Base { 
public: 
  void who() { // define who() relative to first_d 
    cout << "First derivation\n"; 
  } 
}; 
 
class second_d : public Base { 
public: 
  void who() { // define who() relative to second_d 
    cout << "Second derivation\n"; 
  } 
}; 
 
int main() 
{ 
  Base base_obj; 
  Base *p; 
  first_d first_obj; 
  second_d second_obj; 
 
  p = &base_obj; 
  p->who();  // access Base's who 
 
  p = &first_obj; 
  p->who(); // access first_d's who 
 
  p = &second_obj; 
  p->who();  // access second_d's who 
 
  return 0; 
}

listing 17
/* Here, a base class reference is used to access 
   a virtual function. */ 
#include <iostream> 
using namespace std; 
 
class Base { 
public: 
  virtual void who() { // specify a virtual function 
    cout << "Base\n"; 
  } 
}; 
 
class first_d : public Base { 
public: 
  void who() { // define who() relative to first_d 
    cout << "First derivation\n"; 
  } 
}; 
 
class second_d : public Base { 
public: 
  void who() { // define who() relative to second_d 
    cout << "Second derivation\n"; 
  } 
}; 
 
// Use a base class reference parameter. 
void show_who(Base &r) { 
  r.who(); 
} 
 
int main() 
{ 
  Base base_obj; 
  first_d first_obj; 
  second_d second_obj; 
 
  show_who(base_obj);   // access Base's who 
  show_who(first_obj);  // access first_d's who 
  show_who(second_obj); // access second_d's who 
 
  return 0; 
}

listing 18
// Derive from first_d, not Base 
class second_d : public first_d { 
public: 
  void who() { // define who() relative to second_d 
    cout << "Second derivation\n"; 
  } 
};

listing 19
#include <iostream> 
using namespace std; 
 
class Base { 
public: 
  virtual void who() { 
    cout << "Base\n"; 
  } 
}; 
 
class first_d : public Base { 
public: 
  void who() { 
    cout << "First derivation\n"; 
  } 
}; 
 
class second_d : public Base { 
// who() not defined 
}; 
 
int main() 
{ 
  Base base_obj; 
  Base *p; 
  first_d first_obj; 
  second_d second_obj; 
 
  p = &base_obj; 
  p->who();  // access Base's who() 
 
  p = &first_obj; 
  p->who(); // access first_d's who() 
 
  p = &second_obj; 
  p->who();  /* access Base's who() because 
                second_d does not redefine it */ 
 
  return 0; 
}

listing 20
#include <iostream> 
using namespace std; 
 
class figure { 
protected: 
  double x, y; 
public: 
  void set_dim(double i, double j) { 
    x = i; 
    y = j; 
  } 
  virtual void show_area() { 
    cout << "No area computation defined "; 
    cout << "for this class.\n"; 
  } 
} ; 
 
class triangle : public figure { 
  public: 
    void show_area() { 
      cout << "Triangle with height "; 
      cout << x << " and base " << y; 
      cout << " has an area of "; 
      cout << x * 0.5 * y << ".\n"; 
    } 
}; 
 
class square : public figure { 
  public: 
    void show_area() { 
      cout << "Square with dimensions "; 
      cout << x << "x" << y; 
      cout << " has an area of "; 
      cout << x *  y << ".\n"; 
    } 
}; 
 
int main() 
{ 
  figure *p;  /* create a pointer to base type */ 
 
  triangle t;  /* create objects of derived types */ 
  square s; 
 
  p = &t; 
  p->set_dim(10.0, 5.0); 
  p->show_area(); 
  p = &s; 
  p->set_dim(10.0, 5.0); 
  p->show_area(); 
 
  return 0; 
}

listing 21
class circle : public figure { 
  public: 
    void show_area() { 
      cout << "Circle with radius "; 
      cout << x; 
      cout << " has an area of "; 
      cout <<  3.14 * x * x; 
    } 
} ;

listing 22
#include <iostream> 
using namespace std; 
 
class figure { 
protected: 
  double x, y; 
public: 
  void set_dim(double i, double j=0) { 
    x = i; 
    y = j; 
  } 
  virtual void show_area() { 
    cout << "No area computation defined "; 
    cout << "for this class.\n"; 
  } 
} ; 
 
class triangle : public figure { 
  public: 
    void show_area() { 
      cout << "Triangle with height "; 
      cout << x << " and base " << y; 
      cout << " has an area of "; 
      cout << x * 0.5 * y << ".\n"; 
    } 
}; 
 
class square : public figure { 
  public: 
    void show_area() { 
      cout << "Square with dimensions "; 
      cout << x << "x" << y; 
      cout << " has an area of "; 
      cout << x *  y << ".\n"; 
    } 
}; 
 
class circle : public figure { 
  public: 
    void show_area() { 
      cout << "Circle with radius "; 
      cout << x; 
      cout << " has an area of "; 
      cout << 3.14 * x * x; 
    } 
} ; 
 
int main() 
{ 
  figure *p;  /* create a pointer to base type */ 
  triangle t;  /* create objects of derived types */ 
  square s; 
  circle c; 
 
  p = &t; 
  p->set_dim(10.0, 5.0); 
  p->show_area(); 
 
  p = &s; 
  p->set_dim(10.0, 5.0); 
  p->show_area(); 
 
  p = &c; 
  p->set_dim(9.0); 
  p->show_area(); 
 
  return 0; 
}

listing 23
class figure { 
  double x, y; 
public: 
  void set_dim(double i, double j=0) { 
    x = i; 
    y = j; 
  } 
  virtual void show_area() = 0; // pure 
} ;

listing 24
/* 
   This program will not compile because the class 
   circle does not override show_area(). 
*/ 
#include <iostream> 
using namespace std; 
 
class figure { 
protected: 
  double x, y; 
public: 
  void set_dim(double i, double j) { 
    x = i; 
    y = j; 
  } 
  virtual void show_area() = 0; // pure 
} ; 
 
class triangle : public figure { 
  public: 
    void show_area() { 
      cout << "Triangle with height "; 
      cout << x << " and base " << y; 
      cout << " has an area of "; 
      cout << x * 0.5 * y << ".\n"; 
    } 
}; 
 
class square : public figure { 
  public: 
    void show_area() { 
      cout << "Square with dimensions "; 
      cout << x << "x" << y; 
      cout << " has an area of "; 
      cout << x *  y << ".\n"; 
    } 
}; 
 
class circle : public figure { 
// no definition of show_area() will cause an error 
}; 
 
int main() 
{ 
  figure *p;  // create a pointer to base type  
  circle c;   // attempt to create an object of type circle -- ERROR 
  triangle t; // create objects of derived types */ 
  square s; 
 
  p = &t; 
  p->set_dim(10.0, 5.0); 
  p->show_area(); 
 
  p = &s; 
  p->set_dim(10.0, 5.0); 
  p->show_area(); 
 
  return 0; 
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美综合色| 美女视频一区二区三区| 一区二区在线观看免费视频播放| 中文字幕一区二区三中文字幕| 亚洲男人的天堂在线观看| 亚洲一区在线看| 亚洲国产精品久久一线不卡| 三级一区在线视频先锋 | 色综合久久99| 欧美日韩在线观看一区二区 | 国产精品成人在线观看| 亚洲午夜影视影院在线观看| 久久97超碰色| 高清不卡一二三区| 9191久久久久久久久久久| 久久久91精品国产一区二区精品 | 亚洲图片欧美一区| 国产成人av电影在线播放| 欧美美女视频在线观看| 国产精品伦理一区二区| 久久成人av少妇免费| 在线视频你懂得一区| 欧美精品一区在线观看| 亚洲一二三区不卡| 欧美亚日韩国产aⅴ精品中极品| 中文字幕日韩精品一区| 成人免费看的视频| 欧美国产精品劲爆| av色综合久久天堂av综合| 久久精品一区八戒影视| 国产精品亚洲人在线观看| 亚洲精品在线电影| 国产麻豆一精品一av一免费 | 中文字幕av资源一区| 国产高清在线观看免费不卡| 久久久精品免费网站| 国产成人午夜电影网| 国产精品三级久久久久三级| 成人国产免费视频| 亚洲欧美偷拍另类a∨色屁股| 91欧美一区二区| 午夜在线成人av| 欧美一区日韩一区| 国产综合久久久久影院| 中文在线一区二区| 91农村精品一区二区在线| 一区二区国产盗摄色噜噜| 欧美精品tushy高清| 久久精品国产99| 中文字幕av一区 二区| 色老综合老女人久久久| 日本不卡123| 国产亚洲精品7777| 在线一区二区观看| 青娱乐精品视频在线| 久久先锋资源网| 91理论电影在线观看| 亚洲午夜私人影院| 久久午夜羞羞影院免费观看| heyzo一本久久综合| 午夜视黄欧洲亚洲| 久久一日本道色综合| 91在线观看污| 日本亚洲一区二区| 亚洲欧美综合色| 欧美一三区三区四区免费在线看| 国产精品一线二线三线精华| 亚洲欧美激情小说另类| 精品久久人人做人人爽| 色综合久久99| 国产一区二区成人久久免费影院| 亚洲柠檬福利资源导航| 欧美精品一区二区三区高清aⅴ| 97精品久久久午夜一区二区三区 | 一本色道a无线码一区v| 老司机午夜精品| 亚洲激情第一区| 2023国产一二三区日本精品2022| 一本一本久久a久久精品综合麻豆| 免费观看成人av| 一区二区高清在线| 国产免费成人在线视频| 欧美日韩免费一区二区三区| 国产91色综合久久免费分享| 午夜伊人狠狠久久| 国产精品久久久久久久久晋中| 欧美一区二区日韩一区二区| 91久久精品一区二区二区| 国产成人丝袜美腿| 激情综合一区二区三区| 免费成人性网站| 亚洲电影在线播放| 一级日本不卡的影视| 国产精品乱码妇女bbbb| 欧美xxx久久| 日韩一级免费观看| 777精品伊人久久久久大香线蕉| 99久久综合精品| 国产成人精品亚洲777人妖 | 91免费看视频| 处破女av一区二区| 国产精品一区2区| 日韩电影在线观看一区| 亚洲大片一区二区三区| 亚洲蜜桃精久久久久久久| 亚洲欧洲在线观看av| 欧美高清在线精品一区| 久久久久久久久99精品| 日韩一区二区三区电影在线观看| 欧美亚洲综合在线| 欧美视频精品在线观看| 欧美日免费三级在线| 欧美日韩一区三区四区| 欧美日韩国产一区二区三区地区| 91福利国产精品| 欧美三级在线播放| 欧美精品国产精品| 欧美日韩高清一区二区| 日韩一区二区三区视频在线| 欧美日韩综合不卡| 制服丝袜亚洲精品中文字幕| 91 com成人网| 日韩视频免费观看高清完整版| 日韩一级二级三级精品视频| 欧美电影免费观看完整版| 精品国产亚洲一区二区三区在线观看| 精品国产污污免费网站入口| 国产亚洲欧洲997久久综合| 国产精品每日更新在线播放网址 | 青草av.久久免费一区| 男人的天堂亚洲一区| 国模大尺度一区二区三区| 高清av一区二区| 91国偷自产一区二区开放时间| 日本韩国一区二区| 91精品国产91久久久久久一区二区 | 欧美午夜视频网站| 日韩三级免费观看| 国产色爱av资源综合区| 亚洲激情综合网| 看国产成人h片视频| 丰满亚洲少妇av| 欧美视频中文字幕| 久久先锋影音av鲁色资源网| 亚洲欧洲精品一区二区精品久久久| 亚洲激情男女视频| 国内成人精品2018免费看| 99免费精品在线| 日韩欧美一级特黄在线播放| 国产精品色眯眯| 午夜激情久久久| 高清国产一区二区| 欧美熟乱第一页| 中文字幕电影一区| 视频一区二区三区入口| 粉嫩一区二区三区在线看| 欧美午夜一区二区三区免费大片| 2020国产精品自拍| 亚洲一区视频在线| 丰满岳乱妇一区二区三区| 777久久久精品| 亚洲欧美一区二区三区久本道91 | www国产亚洲精品久久麻豆| 国产精品国产三级国产aⅴ中文| 亚洲午夜免费电影| av不卡一区二区三区| 欧美一区二区人人喊爽| 一区二区三区国产豹纹内裤在线| 久久成人精品无人区| 欧美日韩国产经典色站一区二区三区 | 亚洲素人一区二区| 国产真实乱子伦精品视频| 欧美日韩综合在线免费观看| 中文字幕一区二区三区蜜月| 久久99久久99小草精品免视看| 精品视频在线免费| 亚洲天堂av一区| 成人中文字幕在线| 精品久久人人做人人爽| 丝袜亚洲另类丝袜在线| 一本大道久久a久久精二百 | 精品日韩av一区二区| 亚洲电影激情视频网站| 一本大道久久a久久精品综合| 国产精品欧美经典| 成人免费高清视频在线观看| 日韩欧美激情在线| 蜜臀久久久99精品久久久久久| 欧洲一区二区三区在线| 一区二区三区在线视频播放| aaa亚洲精品一二三区| 亚洲国产成人在线| 成人av在线资源| 国产欧美精品在线观看| 老汉av免费一区二区三区| 精品日韩一区二区| 国产乱码精品一区二区三区忘忧草| 精品日韩欧美一区二区| 狠狠色2019综合网| 久久精品欧美日韩精品|