![]() |
|
#1
|
|||
|
|||
Classes & Collections***Header Files:
Point.h Code:
PointCollection.h Code:
//////////////////////////////////////////////////////////////////////// ***Source Files: Point.cpp Code:
PointCollection.cpp Code:
Main.cpp Code:
This is the Error I'm Getting: ------ Build started: Project: Project_Dibujo, Configuration: Debug Win32 ------ Compiling... Point.cpp PointCollection.cpp c:\documents and settings\mpayne007\my documents\visual studio 2005\projects\project_dibujo\project_dibujo\pointc ollection.cpp(85) : error C2511: 'bool Point::includes(const Point &) const' : overloaded member function not found in 'Point' c:\documents and settings\mpayne007\my documents\visual studio 2005\projects\project_dibujo\project_dibujo\point. h(7) : see declaration of 'Point' c:\documents and settings\mpayne007\my documents\visual studio 2005\projects\project_dibujo\project_dibujo\pointc ollection.cpp(103) : error C2784: 'bool std::operator ==(const std::allocator<_Ty> &,const std::allocator<_Other> &) throw()' : could not deduce template argument for 'const std::allocator<_Ty> &' from 'const Point' c:\program files\microsoft visual studio 8\vc\include\xmemory(174) : see declaration of 'std::operator ==' c:\documents and settings\mpayne007\my documents\visual studio 2005\projects\project_dibujo\project_dibujo\pointc ollection.cpp(103) : error C2784: 'bool std::operator ==(const std::istreambuf_iterator<_Elem,_Traits> &,const std::istreambuf_iterator<_Elem,_Traits> &)' : could not deduce template argument for 'const std::istreambuf_iterator<_Elem,_Traits> &' from 'const Point' c:\program files\microsoft visual studio 8\vc\include\xutility(2143) : see declaration of 'std::operator ==' c:\documents and settings\mpayne007\my documents\visual studio 2005\projects\project_dibujo\project_dibujo\pointc ollection.cpp(103) : error C2784: 'bool std::operator ==(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const Point' c:\program files\microsoft visual studio 8\vc\include\xutility(1826) : see declaration of 'std::operator ==' c:\documents and settings\mpayne007\my documents\visual studio 2005\projects\project_dibujo\project_dibujo\pointc ollection.cpp(103) : error C2784: 'bool std::operator ==(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const Point' c:\program files\microsoft visual studio 8\vc\include\utility(60) : see declaration of 'std::operator ==' c:\documents and settings\mpayne007\my documents\visual studio 2005\projects\project_dibujo\project_dibujo\pointc ollection.cpp(103) : error C2676: binary '==' : 'const Point' does not define this operator or a conversion to a type acceptable to the predefined operator Generating Code... Compiling... Main_.cpp Generating Code... Build log was saved at "file://c:\Documents and Settings\MPayne007\My Documents\Visual Studio 2005\Projects\Project_Dibujo\Project_Dibujo\Debug\ BuildLog.htm" Project_Dibujo - 6 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== |
|
#2
|
|||
|
|||
Re: Classes & CollectionsSince there wasn't any actual question posted, I'll go with the implied question that asks "WTF am I doing wrong?!"
Rather than go through it all, I'll just post the changes that were required to fix it. Point.h CPP / C++ / C Code:
PointCollection.h CPP / C++ / C Code:
Point.cpp CPP / C++ / C Code:
PointCollection.cpp CPP / C++ / C Code:
Everything compiled without errors or warnings on my Linux system, but I didn't execute or otherwise test or review the code for anything other than successful compilation. You may note that I followed your coding style as closely as possible. :davis: |
|
#3
|
|||
|
|||
Re: Classes & CollectionsThank You very much Davis.
I have added a new class to the previous program but I'm getting an error with the draw() function: Here's the Header of the new class Page.h: CPP / C++ / C Code:
Here's the Source Code of the new class Page.cpp: CPP / C++ / C Code:
------ Build started: Project: Project_Dibujo, Configuration: Debug Win32 ------ Compiling... Page.cpp c:\documents and settings\mpayne007\my documents\visual studio 2005\projects\project_dibujo\project_dibujo\page.c pp(75) : warning C4832: token '.' is illegal after UDT 'PointCollection' c:\documents and settings\mpayne007\my documents\visual studio 2005\projects\project_dibujo\project_dibujo\pointc ollection.h(8) : see declaration of 'PointCollection' c:\documents and settings\mpayne007\my documents\visual studio 2005\projects\project_dibujo\project_dibujo\page.c pp(75) : error C2275: 'PointCollection' : illegal use of this type as an expression c:\documents and settings\mpayne007\my documents\visual studio 2005\projects\project_dibujo\project_dibujo\pointc ollection.h(8) : see declaration of 'PointCollection' c:\documents and settings\mpayne007\my documents\visual studio 2005\projects\project_dibujo\project_dibujo\page.c pp(78) : error C2059: syntax error : '[' c:\documents and settings\mpayne007\my documents\visual studio 2005\projects\project_dibujo\project_dibujo\page.c pp(79) : error C2143: syntax error : missing ';' before '{' c:\documents and settings\mpayne007\my documents\visual studio 2005\projects\project_dibujo\project_dibujo\page.c pp(80) : error C2143: syntax error : missing ';' before '[' c:\documents and settings\mpayne007\my documents\visual studio 2005\projects\project_dibujo\project_dibujo\page.c pp(80) : error C2337: 'p' : attribute not found c:\documents and settings\mpayne007\my documents\visual studio 2005\projects\project_dibujo\project_dibujo\page.c pp(80) : error C2143: syntax error : missing ';' before '.' Build log was saved at "file://c:\Documents and Settings\MPayne007\My Documents\Visual Studio 2005\Projects\Project_Dibujo\Project_Dibujo\Debug\ BuildLog.htm" Project_Dibujo - 6 error(s), 1 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== A simple hint that would help me solve this problems would be good. Max. |
|
#4
|
|||
|
|||
Re: Classes & CollectionsDo you have an object/array named PointCollection somewhere? I believe that PointCollection is the name of your class so you can't make a statement like
PointCollection[0].size(); You could however create an instance of that class and then use it: PointCollection pc; pc.size(); |
|
#5
|
|||
|
|||
Re: Classes & CollectionsSomething so stupid can be torture to newbies.
Thank you very much for the Help... |
Recent GIDBlog
Writing a book by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Trouble with Classes Within Classes | jdbrine | C++ Forum | 2 | 29-Jun-2006 15:26 |
| Classes initiation | kdsXchris | C++ Forum | 3 | 05-Jun-2006 03:07 |
| How do you make your own collections objects accept multiple types? | robynkartinian | C++ Forum | 19 | 06-Mar-2006 10:23 |
| Assistance with classes... | Bravebird | C++ Forum | 7 | 27-Apr-2005 13:17 |
| Fairly simple classes help please | sammacs | C++ Forum | 0 | 30-Nov-2004 09:58 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The