| | |
Point*& to Point&
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Dec 2008
Posts: 2
Reputation:
Solved Threads: 0
I'm currently working on implementing a small game in C++, but when trying to compile, I get this error:
So I think I now have Ship*&, which should actually be Ship&.
Is there any way to convert Ship*& to Ship&?
Thanks
C++ Syntax (Toggle Plain Text)
..quadtree.h:125: error: no matching function for call to 'Fleet::Ship::overlaps(const Fleet::Ship*&)' ..ship.h:40: note: candidates are: bool Ship::overlaps(const Rectangle&) const ..ship.h:85: note: bool Ship::overlaps(const Ship&) const ..ship.h:32: note: bool Ship::overlaps(const Point&) const
So I think I now have Ship*&, which should actually be Ship&.
Is there any way to convert Ship*& to Ship&?
Thanks
C++ Syntax (Toggle Plain Text)
//... Ship old_ship; Ship *new_ship=new Ship; old_ship.overlaps(new_ship); //...
Last edited by cikara21; Dec 5th, 2008 at 4:01 am.
•
•
Join Date: Dec 2007
Posts: 360
Reputation:
Solved Threads: 69
In the function call here
you are passing a pointer instead of a reference. Dereference the parameter by prefixing it with a '*'.
C++ Syntax (Toggle Plain Text)
'Fleet::Ship::overlaps(const Fleet::Ship*&)'
C++ Syntax (Toggle Plain Text)
class A; void func(A & a) {...} A a; A *p = &a; func(*p); // like this
If you are forced to reinvent the wheel at least try to invent a better one!
Please use code tags - Please mark solved threads as solved
Please use code tags - Please mark solved threads as solved
![]() |
Similar Threads
- Hardware Interrupts & 100% CPU usage (Windows NT / 2000 / XP)
- Help. Computer freezes new cpu & mobo (Motherboards, CPUs and RAM)
- Windows XP pro & Global changes (Windows NT / 2000 / XP)
- void sort2(char* &p, char* &q) (C++)
- Buying & Selling Google PageRank (Website Reviews)
- Populating & Retrieving Data in a listbox : ASP.NET (w/ VB.NET) (ASP.NET)
Other Threads in the C++ Forum
- Previous Thread: All the programmers
- Next Thread: C++ Radix Sort - Bitshift Operators
| Thread Tools | Search this Thread |
api array beginner bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion count database delete desktop developer directshow dll download dynamic email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets







