Advertisement

05.23.2006 at 01:27AM PDT, ID: 21860246
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.2

Copy constructor or parameterized constructor

Asked by dennis_george in C++ Programming Language

Tags: ,

Hi all,

I am getting a strange compilaton error.... I am working on g++ 3.4.2..... Following is the scenario.....

I have two independent classes(A and B) and a global function which returns reference to an instance of class A.

class A{
public:
      A()
      {
                cout << "A constructor" << endl;
      }      
};

// Method returns reference to A
A& GetData()
{
      static A obj;
      return obj;
}


class B{
public:
      B()
      {
                cout << "B constructor" << endl;
      }      

     // Parameterized constructor taking reference to object A
      B(const A& refObj)
      {
                cout << "B param constructor" << endl;
      }      
private:
    // Private copy constructor
     B(const B& ref)
      {
                cout << "B copy constructor" << endl;
      }      
};

Now if I create an object(as shown below) of B I am getting an error....

B obj = GetData(); // It should result in call to the parameterized constructor....
// But it gives me an error saying B's copy constructor is private....

So is it a vaild behaviour or is it some sort of bug in gcc?  
Start Free Trial
 
Keywords: Copy constructor or parameterized co…
 
Loading Advertisement...
 
[+][-]05.23.2006 at 01:31AM PDT, ID: 16740607

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.23.2006 at 01:48AM PDT, ID: 16740654

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.23.2006 at 01:58AM PDT, ID: 16740687

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.23.2006 at 01:59AM PDT, ID: 16740694

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.23.2006 at 02:19AM PDT, ID: 16740764

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.23.2006 at 03:17AM PDT, ID: 16740996

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.23.2006 at 03:52AM PDT, ID: 16741160

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.23.2006 at 05:04AM PDT, ID: 16741588

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.24.2006 at 01:20AM PDT, ID: 16749312

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.24.2006 at 02:16AM PDT, ID: 16749536

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.24.2006 at 04:19AM PDT, ID: 16750081

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.24.2006 at 04:24AM PDT, ID: 16750116

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.24.2006 at 05:57AM PDT, ID: 16750753

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.24.2006 at 06:31AM PDT, ID: 16751064

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.24.2006 at 09:10AM PDT, ID: 16752759

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.26.2006 at 06:17PM PDT, ID: 16773702

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C++ Programming Language
Tags: constructor, parameterized
Sign Up Now!
Solution Provided By: xf10036
Participating Experts: 4
Solution Grade: A
 
 
[+][-]05.31.2006 at 01:08AM PDT, ID: 16796477

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.31.2006 at 12:29PM PDT, ID: 16801615

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32