|
|
От: |
koenjihyakkei
|
|
| Дата: | 14.07.23 14:38 | ||
| Оценка: | |||
class Base {
static constexpr int ID = 1;
Base(int id) : id_(id) {}
int ReadBd() {
switch(id_) {
case Base::ID:
return 11;
case Foo::ID:
return ((Foo*)this)->ReadBd();
}
unreachable();
}
};
class Foo : Base {
static constexpr int ID = 2;
Foo() : Base(ID) {}
int ReadBd() { return 22; }
};