नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
expression to left of '=' evaluates to a function. Cannot assign to a function (a function is not an l-value)
Remarks
A reference cannot be reinitialized. Dereferencing a reference to a function yields a function, which is an rvalue, to which you cannot assign. Therefore, you cannot assign through a reference to a function.
Example
The following example generates C3854:
// C3854.cpp
int afunc(int i)
{
return i;
}
typedef int (& rFunc_t)(int);
typedef int (* pFunc_t)(int);
int main()
{
rFunc_t rf = afunc; // OK binding a reference to function
pFunc_t pf = &afunc; // OK initializing a pointer to function
*pf = &afunc; // C3854
// try the following line instead
// pf = &afunc;
*rf = &afunc; // C3854
}