'- struct/class の違い ➡︎ デフォルトの可視性
- 基本的にすべて値型
- const は signature に含まれる
- 抽象クラスを作るときは必ずデストラクタを作る
厨二病
class Base {
public:
virtual void f() const volatile noexcept {
}
};
class Derived: public Base {
public:
virtual inline void f() const volatile noexcept override final {
}
};
virtual 継承とそうでないものの違い
// | A.Base | B.Base | Derived |
// | Base | Derived | // virtual
super クラスのコンストラクタを取り込む
class UsingBase
{
public:
UsingBase(int) {
}
};
class Using: public UsingBase
{
public:
using UsingBase::UsingBase;
};
struct Hoge {
Hoge(int) {} // ←これを変換コンストラクタと呼ぶ
operator int() { // ←これを型変換演算子と呼ぶ
return 1;
}
};
int main() {
Hoge h1;
Hoge h2;
Hoge h3 = h1 + h2;
int i = h3; // 型変換演算子に explicit を書くとこれが禁止される
}
Pinned Articles
About
ウェブ界隈でエンジニアとして労働活動に励んでいる @gomi_ningen 個人のブログです
Tags
LLM
promptfoo
GenAI
JavaScript
PowerShell
elasticsearch
fluentd
kibana
nginx
五十嵐裕美
村川梨衣
イベント
logrotate
IoT
Scala
Java
ICMP
iputils
C言語
WUG
mastodon
Swift
AWS
Windows
Clock
PoEAA
アーキテクチャ
DeviceFarm
iOS
プログラミング言語
OS
Lambda
StepFunctions
Serverless
terraform
ポエム
ネットワーク
RHEL
GraphQL
CloudWatch
Coreutils
Linux
telnet
nc
network
LinuxKernel
fpinscala
ELB
IAM
AppSync