Permalink
Browse files

Add C++ notes

  • Loading branch information...
hparra committed Dec 12, 2016
1 parent 0a71cf8 commit bfbe7068c9e4979045aec8e54411bbff91bedda0
Showing with 17 additions and 0 deletions.
  1. +17 −0 cpp.md
View
17 cpp.md
@@ -0,0 +1,17 @@
+cpp -- C++
+==========
+
+_These notes are for people who have not used C++ in a long time -- like myself._
+
+[Rule of Three](https://en.wikipedia.org/wiki/Rule_of_three_%28C%2B%2B_programming%29) -- 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.

0 comments on commit bfbe706

Please sign in to comment.