C++ Assignment Operator

This page answers questions like these:

Related Links:
Difference Between char* and char [] and char s[n]
Difference Between char* s = "string"; and char s[] = "string";
Static Member Function Declaration and Definition
Static Assertion / Compile-Time Assertion
warning: invalid conversion from 'char**' to 'const char**'



How to Write an Assignment Operator in C++?

// Handles OBJECT1 = OBJECT2; where both objects are of type CLASS_NAME. CLASS_NAME& operator = (const CLASS_NAME& op2); // Handles OBJECT = string; (string is a standard C++ class) CLASS_NAME& operator = (const string& op2); // Handles OBJECT = char*; CLASS_NAME& operator = (const char* op2);



Related Links:
Difference Between char* and char [] and char s[n]
Difference Between char* s = "string"; and char s[] = "string";
Static Member Function Declaration and Definition
Static Assertion / Compile-Time Assertion
warning: invalid conversion from 'char**' to 'const char**'

Home  >  C++  >  C++ Assignment Operator


Tags: assignment operator C++, assignment operator, C++

code-cpp-assignment-operator.txt
C++/assignment-operator.htm
2