Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

纠正错误 #1

Merged
merged 11 commits into from
Aug 26, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
修改答案
  • Loading branch information
haiduo committed Aug 22, 2019
commit 7c6253cec30bd494477f39516338d5ffac9526cb
17 changes: 7 additions & 10 deletions excersize/ch07.md
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,7 @@ class Screen {
Screen(pos ht, pos wd):height(ht), width(wd), contents(ht*wd, ' '){ } // 2
Screen(pos ht, pos wd, char c):height(ht), width(wd), contents(ht*wd, c){ } // 3

char get
() const { return contents[cursor]; }
char get() const { return contents[cursor]; }
char get(pos r, pos c) const { return contents[r*width+c]; }

private:
Expand Down Expand Up @@ -954,14 +953,12 @@ pos Screen::size() const

解:

未定义标识符`pos`。应该改为:

```cpp
Screen::pos Screen::size() const
{
return height * width;
}
```
纠正:错误为 error: extra qualification 'Screen::' on member 'size' [-fpermissive]
则应该去掉Screen::,改为
```cpp
pos size() const{
return height * width;
}

## 练习7.34
如果我们把第256页`Screen`类的`pos`的`typedef`放在类的最后一行会发生什么情况?
Expand Down