Skip to content

Commit

Permalink
修改补充
Browse files Browse the repository at this point in the history
  • Loading branch information
haiduo committed Aug 22, 2019
1 parent 7c6253c commit 56b72d3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions excersize/ch07.md
Original file line number Diff line number Diff line change
Expand Up @@ -959,8 +959,8 @@ pos Screen::size() const
pos size() const{
return height * width;
}

## 练习7.34
```
## 练习7.34
如果我们把第256页`Screen`类的`pos`的`typedef`放在类的最后一行会发生什么情况?
解:
Expand Down Expand Up @@ -1150,7 +1150,7 @@ private:
下面这条声明合法吗?如果不,为什么?

```cpp
vector<NoDefault> vec(10);
vector<NoDefault> vec(10);//vec初始化有10个元素
```
解:
Expand Down Expand Up @@ -1211,7 +1211,7 @@ Sales_data item2("9-999-99999-9");

```cpp
(a) Sales_data &combine(Sales_data); // ok
(b) Sales_data &combine(Sales_data&); // error C2664: 无法将参数 1 从“std::string”转换为“Sales_data &”
(b) Sales_data &combine(Sales_data&); // error C2664: 无法将参数 1 从“std::string”转换为“Sales_data &” 因为隐式转换只有一次
(c) Sales_data &combine(const Sales_data&) const; // 该成员函数是const 的,意味着不能改变对象。而 combine函数的本意就是要改变对象
```
Expand Down

0 comments on commit 56b72d3

Please sign in to comment.