pls i will like you to help me with something
i was practising with c++ classes and i created a class interface called GradeBook, you know that i will need a source file to write the details of the implementation of the public functions? so in the source file i included the headeer file "GradeBook.h" then the next line i declared the class' constructor like this GradeBook::GradeBook(param goes here...){....} but the compiler returned an error message that a constructor cannot return a value, what pissed me off was that.... that's how it is written in the textbook i use; it must have been seeing the first GradeBook before the colons as a return type.. i am getting fed up..:?:
addicted 0 Junior Poster in Training
Recommended Answers
Jump to Postsometimes books contain errors. please post the code you are trying to compile so we can help you.
>>i am getting fed up
we all feel that way at times. But don't give up. When you feel really frustrated, walk away for awhile and do something else, like watch …
Jump to Post1. you did not include the header file <string>
2. If you are not declaring
using namespace std:
after the includes then you need to declare the namespace at each object instance. For example, line 6 would readGradeBook::GradeBook(std::string name){
and line 21
Jump to PostThe problem is that the class must end with a semicolon. Put a semicolon after the closing brace on line 13 of the header file
Jump to PostThis version compiles without errors. In this version I combined the .h and *.cpp into one *.cpp file for simplicity, but you should keep them separate if you wish. I also added the main() function at the bottom of the code. Hope this helps.
#include <iostream> #include …
Jump to Posttry this. It is for VC++ 2003.NET but I don't think there is much difference. You should be able to get an idea of what to do. Click on the images to enlarge them.
And you don't have to register VC to be able to compile …
All 17 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
addicted 0 Junior Poster in Training
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
addicted 0 Junior Poster in Training
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
addicted 0 Junior Poster in Training
John A 1,896 Vampirical Lurker Team Colleague
addicted 0 Junior Poster in Training
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
addicted 0 Junior Poster in Training
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
addicted 0 Junior Poster in Training
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
addicted 0 Junior Poster in Training
addicted 0 Junior Poster in Training
WolfPack 491 Posting Virtuoso Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.