最后加了一点点。

This commit is contained in:
unlockable
2023-06-02 22:05:05 +08:00
parent 99ec01e49d
commit 6a9bb5933a
2 changed files with 8 additions and 7 deletions

View File

@@ -113,4 +113,4 @@
```c++
className operator++(int);
```
26. `<<`和`>>`不能重载为成员函数。`=``[]``()`不能重载为友元函数。
26. `<<`和`>>`不能重载为成员函数,必须重载为友元函数。`=``[]``()`不能重载为友元函数,必须重载为类的成员函数

View File

@@ -1,20 +1,21 @@
#include <iostream>
using std::cout;
using std::cin;
using std::cout;
using std::endl;
template <int x>
struct Factorial {
template <int x> struct Factorial {
static const unsigned long long value = x * Factorial<x - 1>::value;
};
template <>
struct Factorial<0> {
template <> struct Factorial<0> {
static const unsigned long long value = 1;
};
int main() {
Factorial<20> a;
cout << a.value << endl;
int x = 1;
double b = 3;
cout << x / b * 3 << endl;
return 0;
}