Browse Source

Fixes a bug in the example code in object type. Ref<MyReference> myref = Ref<MyReference>(memnew(MyReference));
The statement is a compile error which emits use of overloaded operator '=' is ambiguous (with operand types 'Ref<FuncRef>' and 'FuncRef *')

This commit uses neikeq suggestion of Ref<MyReference> myref(memnew(MyReference));

Fixes #506

cheeseburger 7 years ago
parent
commit
3d603d50d8
1 changed files with 1 additions and 1 deletions
  1. 1 1
      development/cpp/object_class.rst

+ 1 - 1
development/cpp/object_class.rst

@@ -242,7 +242,7 @@ Declaring them must be done using Ref<> template. For example:
         GDCLASS(MyReference, Reference);
     };
 
-    Ref<MyReference> myref = memnew(MyReference);
+    Ref<MyReference> myref(memnew(MyReference));
 
 ``myref`` is reference counted. It will be freed when no more Ref<>
 templates point to it.