c++ - How can I define a function that takes as a parameter a pointer value of any kind? -
I am implementing a smart pointer class practice.
I have already defined the assignment operator overload, taking one more example of the same class. Now I want to define the surcharge of this operator, which takes any indicator. That's why I got the How can I do that? Do I pass in As another general question (and I know that it is rarely desired): What type of parameter tells the compiler that any indicators can be passed? Using a template function to allow you to assign your object to a pointer Can. However, this is not a smart pointer if you can provide it as any raw pointers because it There will be one problem with more than one smart pointer object and then deleting the pointer. smartPointer = & amp; SomeObject; or
smartPointer = NULL; , etc.
void * ? Some more questions?
template & lt; Type name T & gt; Zero operator = (T * oBJ) {// your code here}
Comments
Post a Comment