Chapter 6 Designing Classes

来源:互联网 发布:软件工程项目总监职责 编辑:程序博客网 时间:2024/06/04 00:22

两天完成一章需要包括习题。

到五月底结束。

定义类是从结构体开始

struct Point {    int x;    int y;}

The Point structure from the preceding section is idential to the following class definition:

class Point {public:    int x;    int y;}

Fields that are declared in the private section introduced by the keyword private.

Clients instead use methods exported by the class to obtain access to any information the class contains.

In particular, most classes define a constructor that takes no arguments, which is called the default constructor.



0 0