Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6889583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:10:28+00:00 2026-05-27T06:10:28+00:00

I am trying to setup parameter from one class into another. But for types

  • 0

I am trying to setup parameter from one class into another.
But for types CDC and CBitmap, it won’t let me??

dcMem and m_bmp are instance variables or the parameters in the class

(also note that I am using vc++ 6.0)

error C2582: 'CDC' : 'operator =' function is unavailable
error C2582: 'CBitmap' : 'operator =' function is unavailable

.

Image::Set_dcMem(CDC _dcMem)
{
    dcMem = _dcMem;
}

.

Image::Set_m_bmp(CBitmap _m_bmp)    
{
    m_bmp = _m_bmp;
}

I had also tried just setting the parameters as such from the other class but got the same errors listed above:

Image *pImage = new Image;
pImage->dcMem = dcMem;
pImage->m_bmp = m_bmp;

I found this links, but not sure how to apply:

http://msdn.microsoft.com/en-us/library/ccb3dh5c%28v=vs.80%29.aspx

http://msdn.microsoft.com/en-us/library/aa983787%28v=vs.71%29.aspx

with the correction from down below:

CDC* dcMem;
CBitmap *m_bmp;

Image *pImage = new Image;
pImage->dcMem = &dcMem;
pImage->m_bmp = &m_bmp;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:10:28+00:00Added an answer on May 27, 2026 at 6:10 am

    When you assign an object using = the object is copied, the variable on the left is already instantiated, so it must somehow get a copy of the state of the object on the right side of the assignment.

    But sometimes it is difficult to copy an object. In some cases it is because some of the internal data members of the object cannot be copied, or because it is difficult or time consuming to copy them.

    In any case, when the author of a class decides that copies will not work for that class, he/she undefines the operator= method, to prevent users of the class from ever trying to assign objects of that class. See this question for some additional information on this.

    But this isn’t a huge problem. Normally, for objects of this kind you don’t really want to be happily triggering copies of objects anyway. Instead, what you want to do is work with references and pointers.

    class Image {
        CDC* dcMem; // <-- declare member variable as a reference
    };
    
    Image::Set_dcMem(CDC& _dcMem) // <-- pass references instead of objects
    {
        dcMem = &_dcMem; // <-- you can assign references just fine
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to setup CruiseControl.net at the moment. So far it works nice, but
I'm trying to setup a custom route in MVC to take a URL from
I'm trying setup a subset of boost and get it properly compiled using bjam,
Trying to setup an SSH server on Windows Server 2003. What are some good
Trying to setup a CodeIgniter based project for local development (LAMP stack), and once
After trying to setup my site for Google Webmaster Tools I found that my
I'm trying to setup an Apache/PHP/Postgresql server locally on my machine. I'm using Windows
I am trying to setup tracd for the project I am currently working on.
I am trying to setup a simple demo of activemq and mina. I edited
I am trying to setup a failover location for MOSS. The current farm is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.