Error C2662 Msdn
Contents |
XXX to XXX Visual Studio Languages , Windows Desktop Development > C++ Standards, Extensions, and Interop Question 0 Sign in to vote Please look at my
Error C2662 Conversion Loses Qualifiers
code: #pragma once class CBox { protected: double m_length; double m_width; double m_high; error c2662 cannot convert 'this' pointer from public: CBox(void); virtual ~CBox(void); CBox(double, double, double); virtual double volumn(); void showVolumn(); void showSize(); bool operator < (const CBox&) const; c++ error c2664 }; #include "StdAfx.h" #include "Box.h" #include
C2440
m_width(b), m_high(c){} double CBox::volumn() { return this->m_high * this->m_length * this->m_width; } void CBox::showVolumn() { cout << "this volumn of this box is : " << volumn() << endl; } void CBox::showSize() { cout << "m_lenght : " << m_length << endl; cout << "m_widht : " << m_width << endl; cout << "m_high : " << m_high << endl; } bool CBox::operator <(const
C++ Const Function
CBox & cbox) const { double total1 = m_length + m_width + m_high; double total2 = cbox.m_length + cbox.m_width + cbox.m_high; if (total1 < total2) { return true; } return false; } void test_15() { using namespace std; map
resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation APIs and reference Dev centers Retired content Samples We’re sorry. The content you requested has been removed. You’ll be auto redirected in 1 second. C/C++ Building Reference C/C++ Build Errors Compiler Errors C2600 Through C2699 Compiler Errors C2600 Through https://social.msdn.microsoft.com/Forums/vstudio/en-US/ca0de267-afde-43c2-b0b0-c62edc783307/compiling-error-c2662-cannot-covert-this-pointer-from-xxx-to-xxx?forum=vclanguage C2699 Compiler Error C2664 Compiler Error C2664 Compiler Error C2664 Compiler Error C2600 Compiler Error C2601 Compiler Error C2602 Compiler Error C2603 Compiler Error C2605 Compiler Error C2611 Compiler Error C2612 Compiler Error C2613 Compiler Error C2614 Compiler Error C2616 Compiler Error C2617 Compiler Error C2619 Compiler Error C2624 https://msdn.microsoft.com/en-us/library/s5b150wd.aspx Compiler Error C2626 Compiler Error C2627 Compiler Error C2628 Compiler Error C2630 Compiler Error C2632 Compiler Error C2633 Compiler Error C2634 Compiler Error C2635 Compiler Error C2636 Compiler Error C2637 Compiler Error C2638 Compiler Error C2640 Compiler Error C2645 Compiler Error C2646 Compiler Error C2647 Compiler Error C2648 Compiler Error C2649 Compiler Error C2650 Compiler Error C2651 Compiler Error C2652 Compiler Error C2653 Compiler Error C2654 Compiler Error C2655 Compiler Error C2656 Compiler Error C2657 Compiler Error C2658 Compiler Error C2659 Compiler Error C2660 Compiler Error C2661 Compiler Error C2662 Compiler Error C2663 Compiler Error C2664 Compiler Error C2665 Compiler Error C2666 Compiler Error C2667 Compiler Error C2668 Compiler Error C2669 Compiler Error C2670 Compiler Error C2671 Compiler Error C2673 Compiler Error C2674 Compiler Error C2675 Compiler Error C2676 Compiler Error C2677 Compiler Error C2678 Compiler Error C2679 Compiler Error C2680 Compiler Error C2681 Compiler Er
resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation APIs and reference Dev centers Retired content Samples We’re https://msdn.microsoft.com/en-us/library/dyafzty4.aspx sorry. The content you requested has been removed. You’ll be auto redirected in http://www.errorbase.net/1845/error-c2662-function-cannot-convert-this-pointer-from-type1-to-type2 1 second. C/C++ Building Reference C/C++ Build Errors Compiler Errors C2600 Through C2699 Compiler Errors C2600 Through C2699 Compiler Error C2666 Compiler Error C2666 Compiler Error C2666 Compiler Error C2600 Compiler Error C2601 Compiler Error C2602 Compiler Error C2603 Compiler Error C2605 Compiler Error C2611 Compiler Error C2612 Compiler Error C2613 Compiler Error C2614 error c2662 Compiler Error C2616 Compiler Error C2617 Compiler Error C2619 Compiler Error C2624 Compiler Error C2626 Compiler Error C2627 Compiler Error C2628 Compiler Error C2630 Compiler Error C2632 Compiler Error C2633 Compiler Error C2634 Compiler Error C2635 Compiler Error C2636 Compiler Error C2637 Compiler Error C2638 Compiler Error C2640 Compiler Error C2645 Compiler Error C2646 Compiler Error C2647 Compiler Error C2648 Compiler Error C2649 Compiler Error C2650 Compiler Error error c2662 msdn C2651 Compiler Error C2652 Compiler Error C2653 Compiler Error C2654 Compiler Error C2655 Compiler Error C2656 Compiler Error C2657 Compiler Error C2658 Compiler Error C2659 Compiler Error C2660 Compiler Error C2661 Compiler Error C2662 Compiler Error C2663 Compiler Error C2664 Compiler Error C2665 Compiler Error C2666 Compiler Error C2667 Compiler Error C2668 Compiler Error C2669 Compiler Error C2670 Compiler Error C2671 Compiler Error C2673 Compiler Error C2674 Compiler Error C2675 Compiler Error C2676 Compiler Error C2677 Compiler Error C2678 Compiler Error C2679 Compiler Error C2680 Compiler Error C2681 Compiler Error C2682 Compiler Error C2683 Compiler Error C2687 Compiler Error C2688 Compiler Error C2689 Compiler Error C2690 Compiler Error C2691 Compiler Error C2692 Compiler Error C2693 Compiler Error C2694 Compiler Error C2695 Compiler Error C2696 Compiler Error C2698 TOC Collapse the table of content Expand the table of content This documentation is archived and is not being maintained. This documentation is archived and is not being maintained. Compiler Error C2666 Visual Studio 2015 Other Versions Visual Studio 2013 Visual Studio 2012 Visual Studio 2010 Visual Studio 2008 Visual Studio 2005 Visual Studio .NET 2003 'identifier' : number overloads have similar conversionsAn overloaded function or operator is ambiguous. Formal parameter lists may be to
error messages. Tweet Most popular tags programming languages visual c++ compile time error messages programming-languages visual-c compile-time-error-messages java mysql dbms runtime-error-messages Photoshop oracle netbeans nudge photoshop mosek rasterize subversion php sql vector data svn facebook tomcat latex apache visual sap phpmyadmin runtime error messages c type layer windows eclipse-svn-subversion-java photos pool paypal sqlserver driver commit rsa 2010 adobe-premiere-pro c# jquery javascript firebug lyx asp memory-leaks Error C2662: (function) : cannot convert 'this' pointer from (type1) to (type2) 0 votes The compiler could not convert the this pointer from type1to type2. This error can be caused by invoking a non-const member function on a const object. compile time error messages programming languages visual c++ requested 5 years ago by errorbase (170,010 points) 3 Solutions 0 votes This article is a derivative work based on http://msdn.microsoft.com/en-us/library/2s2d2tez.aspx" title="http://msdn.microsoft.com/en-us/library/2s2d2tez.aspx" target="_blank">Compiler Error C2662 which is provided by http://msdn.microsoft.com/en-us/library/60k1461a.aspx" title="http://msdn.microsoft.com/en-us/library/60k1461a.aspx" target="_blank">MSDN Community Content - Visual C++. solved 5 years ago by errorbase (170,010 points) 0 votes Include other causes to the article that may trigger this error. Also give some code examples. solved 5 years ago by errorbase (170,010 points) 0 votes Possible resolutions: Remove the const from the object declaration. Add const to the member function. solved 5 years ago by errorbase (170,010 points) Related errors 0 votes 3 solutions Error C2664: (function) : cannot convert parameter number from (type1) to (type2) requested 5 years ago by errorbase (170,010 points) compile time error messages programming languages visual c++ 0 votes 3 solutions Error C2682: cannot use casting operator to convert from (type1) to (type2) requested 5 years ago by errorbase (170,010 points) compile time error messages programming languages visual c++ 0 votes 3 solutions Error C2440: (conversion) : cannot convert from (type1) to (type2) requested 5 years ago by errorbase (170,010 points) compile time error messages programming languages visual c++ 0 votes 2 solutions Error C3398: (operator) : cannot convert from (function signature) to (function pointer). Source expression must be a function symbol requested 5 years ago by errorbase (170,010 points) compile time error messages programming languages visual c++ 0 v