博客
关于我
(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/

你可能感兴趣的文章
Springboot中@SuppressWarnings注解详细解析
查看>>
Panalog 日志审计系统 sprog_deletevent.php SQL 注入漏洞复现
查看>>
Panalog 日志审计系统 sprog_upstatus.php SQL 注入漏洞复现(XVE-2024-5232)
查看>>
Panalog 日志审计系统 前台RCE漏洞复现
查看>>
PANDA VALUE_COUNTS包含GROUP BY之前的所有值
查看>>
Pandas - 有条件的删除重复项
查看>>
pandas -按连续日期时间段分组
查看>>
pandas -更改重新采样的时间序列的开始和结束日期
查看>>
SpringBoot+Vue+Redis前后端分离家具商城平台系统(源码+论文初稿直接运行《精品毕设》)15主要设计:用户登录、注册、商城分类、商品浏览、查看、购物车、订单、支付、以及后台的管理
查看>>
pandas :to_excel() float_format
查看>>
pandas :加入有条件的数据框
查看>>
pandas :将多列汇总为一列,没有最后一列
查看>>
pandas :将时间戳转换为 datetime.date
查看>>
pandas :将行取消堆叠到新列中
查看>>
pandas DataFrame 中的自定义浮点格式
查看>>
Pandas DataFrame 的 describe()方法详解-ChatGPT4o作答
查看>>
Pandas DataFrame中删除列级的方法链接解决方案
查看>>
Pandas DataFrame中的列从浮点数输出到货币(负值)
查看>>
Pandas DataFrame中的列从浮点数输出到货币(负值)
查看>>
Pandas DataFrame多索引透视表-删除空头和轴行
查看>>