I am following c++ tutorials in tutorial 42,43 iam getting an error while declearing object in classes
i decleared as:sally so;
Please help me in rectifing my mistake.
Object decleration problem
Post a Reply
|Oldest Newest Rating|
· June 11, 2015
Just paste the code you have. It should be trivial to debug.
· June 11, 2015
I created a class named sally.
Sally sally object;
Using namespace std;
Please give me a solution.
· June 12, 2015
The main problems are capitalization, not including sally.h in main.cpp and forgetting the #endif in the header file. Capitalization is case sensitive: IF is different than if.
File names are also case sensitive.
Multiple problems I see is in sally.h:
1)You forgot the #endif at the end of the header file.
2) I'm not sure if your spelling is a typo or not but C++ is case sensitive. Sally is not the same as sally. Is sally the name of the class or Sally? Public, private and protected should be lowercase.
In Sally.cpp, using should be lowercase and cout should be lowercase. Void should also be lower case.
3) In main.cpp, you are never including sally.h. Additionally, to use a method, the object must actually be created.
After fixing capitalization and the rest it should be clear.
I can show you what it should look like.
I don't know what language you started with, but please review the very fundamentals. Some of these issues are pretty big.
using namespace std;
Used in many types of software including music players, video games, and many large scale applications.
|Bucky Roberts Administrator|