質問するログイン新規登録

回答編集履歴

1

サンプルコードのミスを修正

2016/02/06 10:33

投稿

kozuchi
kozuchi

スコア1193

answer CHANGED
@@ -1,11 +1,6 @@
1
1
  VC++ が緩いだけで g++ ではデフォルトでコンパイルエラーになります。
2
2
 
3
3
  ```
4
- $ gcc -o sample sample.cpp
5
- sample.cpp: In function ‘int main()’:
6
- sample.cpp:10:23: error: invalid initialization of non-const reference of type ‘CBase&’ from an rvalue of type ‘CBase’
7
- CBase& base = CBase();
8
- ^
9
4
  $ cat sample.cpp
10
5
  #include <iostream>
11
6
  class CBase {