博客
关于我
(25.2)类的定义之类的数据成员,类的成员函数,类的声明
阅读量:406 次
发布时间:2019-03-05

本文共 2190 字,大约阅读时间需要 7 分钟。

???????????

? C++ ??????????????????????????????????????????????????????????????


1. ??????

????????????????????????????????void???const???????????????????????

  • ???????

    ????????????????????????????????????????????????????

    class Cube {  long color; // ????  double x, y, z, side; // ????};
  • ???????

    ?????????????????????????????????void???const??????

    class ADT {  long color;  double x, y, z, side;  int a[10]; // ??  char *s; // ??  char &r; // ??  void *p; // void??};
  • ????

    ???????????????member object???????????????????

    class Point {  public:  void set(int a, int b) {}  int x, y;};class Line {  public:  void set(Point a, Point b) {}  Point start, end; // ????};

2. ????????

?????????????????????????????????????????????????????

  • ????

    ??????????????????????????

    class ADT {  struct Point {    int x, y;  };  union UData {    Point p;    long color;  };  enum COLORS { RED, GREEN, BLUE, BLACK, WHITE };  typedef Point* LPPOINT;};

3. ??????

????????????????????????????????????????

  • ?????????

    ????????????????????????????????????????????

    void Data::set(int d) {  data = d;}

    ???:: ????????????????? Data??????????????? ???? ??::??? ??????

  • ??????

    ????????????????inline??????????????????????????????C++?????????????????????? inline ???????????

    class Data {  int getx() { return x; }  inline int gety() { return y; }  void setxy(int _x, int _y) {    x = _x;    y = _y;  }};

4. ????????????

????????????????????????????????????????????????????????

  • ????
    class MAX {  int Max(int x, int y) { return x > y ? x : y; }  int Max() { return Max(Max(a, b), Max(c, d)); }  int Set(int i = 1, int j = 1, int k = 3, int l = 4) {    a = i;    b = i;    c = k;    d = l;  }};

5. ?????????

??????????????????????????????????????????????????????????????????????????????????

  • ??
    class Time {  int h, m, s;  void settime(int a, int b, int c) {    h = a;    m = b;    s = c;  }};sizeof(Time) = 12;

6. ???????

  • ???

    ????????????? }???????????????

  • ????

    ?????????????????????

    class Point; // ???

    ??????????????????????????????????????????????????????????


7. ??????????????

  • ????

    ?????????????????????????????????????

  • ????

    ??????????????????????????????????????????????????????


?????????????????????????????????????????????

转载地址:http://ilyzz.baihongyu.com/

你可能感兴趣的文章
Oracle dbms_job.submit参数错误导致问题(ora-12011 无法执行1作业)
查看>>
Oracle GoldenGate Director安装和配置(无图)
查看>>
oracle script
查看>>
Oracle SOA Suit Adapter
查看>>
Oracle Spatial空间数据库建立
查看>>
UML— 活动图
查看>>
Oracle Statspack分析报告详解(一)
查看>>
oracle 使用leading, use_nl, rownum调优
查看>>
Oracle 写存储过程的一个模板还有一些基本的知识点
查看>>
Oracle 创建 DBLink 的方法
查看>>
oracle 创建字段自增长——两种实现方式汇总
查看>>
Oracle 升级10.2.0.5.4 OPatch 报错Patch 12419392 Optional component(s) missing 解决方法
查看>>
oracle 可传输的表空间:rman
查看>>
Oracle 启动监听命令
查看>>
oracle 学习
查看>>
ORACLE 客户端工具连接oracle 12504
查看>>
oracle 行转列
查看>>
Oracle 表
查看>>
Oracle 递归
查看>>
oracle 逻辑优化,提升高度,综合SQL上下文进行逻辑优化
查看>>