Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (19 sloc) 900 Bytes

cpp -- C++

These notes are for people who have not used C++ in a long time -- like myself.

Major interpreters and virtual machines written in C++ include:

  • Hotspot (Java)
  • CLR (.NET)
  • HHVM (PHP/Hack)
  • V8 (JavaScript)
  • SpiderMonkey (JavaScript)
  • Flash

Rule of Three -- if a class requires one or more of these, then it probably needs all three:

  • destructor
  • copy constructor
  • copy assignment operator

Initializer lists

  • constructor can call constructors of members outside of constructor body
  • Example: MyClass::MyClass():someMemberOtherType(1,'param') {}

There is no true concept of null or nil. NULL is simply a macro that expands to the number 0.

A const function e.g. someFunc(param) const {} makes it a compiler error for class function to change a member variable of the class.