Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: Error C2664: Cannot Convert Parameter 1 from 'x' to 'y'

Reply
Thread Tools

Re: Error C2664: Cannot Convert Parameter 1 from 'x' to 'y'

 
 
Jack Klein
Guest
Posts: n/a
 
      06-25-2003
On Wed, 25 Jun 2003 17:31:19 GMT, "Tim Mierzejewski"
<> wrote in comp.lang.c++:

> Could someone look through this code and tell me why I'm getting this error?
> I'm only including the important code here. There's more obviously, but this
> should be enough to solve the problem.
>
> #include "Creature.hpp" // This defines the class Creature.
> void Minotaur(Creature *Player);
>
> int CreatureSelection;
> cin >> CreatureSelection;
> Creature *Play1 = new Creature
> switch (CreatureSelection)
> {
> case (1):
> Minotaur(*Play1); // Line #33


Remove the asterisk in *Play1. Play1 is already a pointer to
Creature. *Play1 would be the Creature object itself, not the
pointer.

> }
> return 0;
>
> void Minotaur(Creature *Player)
> {
> Player->SetValues(50, 20, 9, 4, false, 0, false, false, false, false,
> false) // Calls a function within Creature.hpp.
> }
>
>
> ----
> C:\......FileName.cpp(33): error C2664: 'Minotaur' : cannot convert
> parameter 1 from 'class Creature' to 'class Creature *'
> No user-defined-conversion operator available that can perform this
> conversion, or the operator cannot be called


--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error C2664: 'strcpy' : cannot convert parameter 2 from 'char' to 'const char *' kaizen C++ 3 01-21-2006 08:07 PM
cannot convert parameter from 'double (double)' to 'double (__cdecl *)(double)' error Sydex C++ 12 02-17-2005 06:30 PM
Cannot convert to Ref parameter from C# to VB.Net Sanjay Tibrewal ASP .Net 2 08-04-2004 09:22 PM
Re: Error C2664: Cannot Convert Parameter 1 from 'x' to 'y' John Harrison C++ 1 06-25-2003 08:03 PM
Re: Error C2664: Cannot Convert Parameter 1 from 'x' to 'y' Suzanne C++ 0 06-25-2003 05:38 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57