Move interface reserved cpp impl to source file.

This way these methods can use all of the imported items without other
libraries needing to import them directly.

Test: hidl_test, visually verify generated code looks good
Bug: 36162559
Change-Id: I646791f73cfb4579a3b969cf6e69b65a6325f1cd
diff --git a/generateCpp.cpp b/generateCpp.cpp
index c66dbbb..5164c73 100644
--- a/generateCpp.cpp
+++ b/generateCpp.cpp
@@ -395,14 +395,10 @@
                 if (!isIBase()) {
                     out << " override";
                 }
-                out << " {\n";
-                out.indent();
-                method->cppImpl(IMPL_HEADER, out);
-                out.unindent();
-                out << "\n}\n";
             } else {
-                out << " = 0;\n";
+                out << " = 0";
             }
+            out << ";\n";
         }
 
         out << "// cast static functions\n";
@@ -1843,6 +1839,27 @@
     // generate castFrom functions
     std::string childTypeResult = iface->getCppResultType();
 
+    status_t err = generateMethods(out, [&](const Method *method, const Interface *) {
+        bool reserved = method->isHidlReserved();
+
+        if (!reserved) {
+            out << "// no default implementation for: ";
+        }
+        method->generateCppSignature(out, iface->localName());
+        if (reserved) {
+            out.block([&]() {
+                method->cppImpl(IMPL_HEADER, out);
+            }).endl();
+        }
+
+        out << "\n";
+
+        return OK;
+    });
+    if (err != OK) {
+        return err;
+    }
+
     for (const Interface *superType : iface->typeChain()) {
         out << "// static \n"
             << childTypeResult