answersLogoWhite

0


Best Answer

class travel {

...

travel &operator=( some type );

... or ...

travel operator=( some type );

...

};

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the correct declaration of the assignment operator overloaded function inside the travel class?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why a friend function cannot be used to overload the assignment operator?

Assignment(=) operator is a special operator that will be provided by the constructor to the class when programmer has not provided(overloaded) as member of the class.(like copy constructor). When programmer is overloading = operator using friend function, two = operations will exists: 1) compiler is providing = operator 2) programmer is providing(overloading) = operator by friend function. Then simply ambiguity will be created and compiler will gives error. Its compilation error.


How can you differentiate overloading of pre-fix and post-fix increment operator?

The prefix increment operator is overloaded as operator++() while the postfix increment operator is overloaded as operator++(int).


What are the disadvantages of scope resolution operator?

it cannot be operator overloaded.


Why ternary operator is not overloaded?

The ternary operator (known as the conditional operator in C++) cannot be overloaded because it is impossible to pass a test operand and two expression operands (either or both of which may be comma-separated) to a function. You can only pass values or references as arguments to a function. Even if it were possible, built-in functions and operators that rely on the conditional operator would likely break. Like all the other operators that cannot be overloaded (sizeof, typeid, ::, . and .*) the results must always be predictable because built-in operators and functions rely on them so heavily.


How do you represent assignment by bitwise XOR operator?

The bitwise XOR operator is ^, or shift 6. The bitwise XOR assignment operator is ^=.


What is the operator that cannot be overloaded?

There are 5 operators which cannot be overloaded. They are: * .* - class member access operator * :: - scope resolution operator * . - dot operator * ?:: - conditional operator * Sizeof() - operator Note:- This is possible only in C++.


What is the operator that cannot be overloaded in c plus plus and java?

conditional operator , size of operator , membership operator and scope resulation operator can not be overload in c++


Can the scope resolution operator be overloaded in C plus plus?

No.


How can you can create a new operator through operator overloading?

You cannot create any new operators in C++. You can only overload the existing ones (although some, such as sizeof, new and delete cannot be overloaded). The only way to create a new operator is to implement it as a standard function with a named identifier. For instance, sqrt() is the standard library function that provides the square root operator, for which no real operator exists.


Do you have source code in c for assignment operator?

I'm not sure what you mean, but the c assignment operator is the equal sign, =


How operator overloading differ from function overloading?

Function overloading is multiple definition with different signatures(the parameters should be different) for the same function. The parameter list have to be different in each definition. The compiler will not accept if the return type alone is changed. Operator overloading is defining a function for a particular operator. The operator loading function can not be overloaded through function overloading.


Which operator cannot be overloaded c plus plus?

comma (,) is an example