No matching function for call SomeClass::SomeClass(something & ref, foo *& p)
Candidates are...
No matching function for call SomeClass::SomeClass(something & ref, int) //in this case null pointer is detected as "int" O_O
Candidates are...
I feel like I'm missing some fundamental thing. Tried to google and read FAQS but didn't find anything
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
The error says that you are trying to use *&p as the second parameter. The compiler understands that it is a pointer to a reference, when you have to pass just a pointer. I can't tell really why using a const on the first parameter will help though, can you post actual code?
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
class Bar;
class MyClass
{
MyClass(){}
};
class Foo
{
public:
Foo(MyClass & myFoo,Bar * bar)
{
}
};
class Bar
{
public:
Bar()
{
}
};
Seems that is impossibile mixing references and pointers in the same contructor (unless the reference is const).
Anyway I found some readings that tells to avoid Non-const references in constructors (without explaining why :/)
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Anyway I found some readings that tells to avoid Non-const references in constructors (without explaining why :/)
Hmm, I don't know about mingw specifically, but perhaps they are saying that--"conceptually" speaking--constructors should just take external data for copying and not alter it.
I hadn't read that before but I suppose it makes sense, unless you're using a manipulator or function object or something. (I don't know if you would even want a functor to do that. It seems messy. I just meant that there may be exceptions to whatever that rule is.)
"Computers don't make mistakes! What they do they do on purpose!!"
Your code above compiles here on MinGW (once I add a main()). And using non-const references in constructors should be all right - if you have references in your class this is even the only way to set them.
CuteAlien wrote:Your code above compiles here on MinGW (once I add a main()). And using non-const references in constructors should be all right - if you have references in your class this is even the only way to set them.
that compile ?O_O i'll try to re-install. still don't compile here O_O thx for trying
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me