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/error: invalid conversion from 'char**' to 'const char**'
error: the compiler can assume that the address of '...' will always evaluate to 'true'



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/error: invalid conversion from 'char**' to 'const char**'
error: the compiler can assume that the address of '...' will always evaluate to 'true'

Home  >  C++  >  C++ Assignment Operator


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

Copyright © HelpDoco.com
code-cpp-assignment-operator.txt
C++/assignment-operator.htm
1