473,324 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Help Please

9
I am doing an assingment for class and I have everything execpt it will not compile. I get these errors

/Users/hjast89/Desktop/test/shape.cpp:36: error: expected `}' at end of input
/Users/hjast89/Desktop/test/shape.h:25: error: virtual outside class declaration
/Users/hjast89/Desktop/test/shape.h:25: error: function 'void draw()' is initialized like a variable
/Users/hjast89/Desktop/test/shape.cpp:15: error: a function-definition is not allowed here before '{' token
/Users/hjast89/Desktop/test/shape.cpp:22: error: a function-definition is not allowed here before '{' token
/Users/hjast89/Desktop/test/shape.cpp:29: error: a function-definition is not allowed here before '{' token
/Users/hjast89/Desktop/test/shape.cpp:34: error: a function-definition is not allowed here before '{' token
/Users/hjast89/Desktop/test/shape.cpp:36: error: expected `}' at end of input
/Users/hjast89/Desktop/test/shape.cpp: At global scope:
/Users/hjast89/Desktop/test/shape.cpp:36: error: expected unqualified-id at end of input
Build failed (9 errors, 1 warning)

Expand|Select|Wrap|Line Numbers
  1. #include "shape.h"
  2. #include <iostream>
  3.  
  4.  
  5. int Shape::getCenter_X()
  6. {
  7.   cout << "In the Shape: get Center X" << endl;
  8.   // Code for the withdraw function here
  9.   return 1;
  10. }
  11.  
  12. int Shape::getCenter_Y()
  13. {
  14.   cout << "In the Shape get Center Y" << endl;
  15.   // Code for showAllChecksCleared() function here
  16.   return 1;
  17. }
  18.  
  19. void Circle::printAllValues ()
  20. {
  21.   cout << "In the Circle print all values" << endl;
  22. }
  23.  
  24. void Rectangle::printAllValues()
  25. {
  26.     cout <<"In the Rectangle print all values" <<endl;
  27. }
This is the code that it gives it to me. The .h file just has the class definitions. I would appreciate if someone could tell me what I am doing wrong.
Oct 10 '07 #1
3 2239
Banfa
9,065 Expert Mod 8TB
The .h may just contain the class definition but that is where I suspect the error is.
Oct 10 '07 #2
hjast
9
Here is the the code for the .h


Expand|Select|Wrap|Line Numbers
  1. #include <iostream.h>
  2.  
  3.  
  4. class Shape
  5. {
  6.   private:
  7.      int x_Center, y_Center;
  8.  
  9.   public:
  10.     Shape()
  11.     {
  12.     cout <<"In defualt constructer";
  13.     }
  14.      // Constructors
  15.      Shape(int cx, int cy)
  16.     {
  17.         x_Center=cx;
  18.         y_Center=cy;
  19.     {
  20.  
  21.      // Member functions
  22.      void getCenter_X();
  23.      void getCenter_Y();
  24.      virtual void draw()=0;
  25. };
  26.  
  27. class Rectangle : public Shape
  28. {
  29. private:
  30.     int length,width;
  31.  
  32.  public:
  33.  
  34.   // Default constructor
  35.   Rectangle ()
  36.     {
  37.       cout << "In the default constructor of CheckingAccount" << endl;
  38.     }
  39.  
  40.   // Constructor
  41.   Rectangle (int cx, int cy,int l,int w) : Shape(cx, cy)
  42.     {
  43.     length=l;
  44.     width=w;
  45.       cout << "In CheckingAccount constructor" << endl;
  46.     }
  47.  
  48.     // Destructor
  49.     ~Rectangle ()
  50.       {
  51.     cout << "In CheckingAccount destructor" << endl;
  52.       }
  53.  
  54.     // Methodds
  55.     void printAllValues();
  56. };
  57.  
  58. class Circle : public Shape
  59. {
  60. private:
  61. int diameter;
  62.  
  63.  public:
  64.  
  65.   // Default Constructor
  66.   Circle ()
  67.     {
  68.       cout << "In the default constructor of IRA_Account" << endl;
  69.     }
  70.  
  71.   // Constructor
  72.   Circle (int ssn, int acctNum) : Shape (ssn, acctNum)
  73.     {
  74.       cout << "In IRA_Account constructor" << endl;
  75.     }
  76.  
  77.     // Destructor
  78.     ~Circle ()
  79.       {
  80.     cout << "In IRA_Account destructor" << endl;
  81.       }
  82.  
  83.     // Methods
  84.     void printAllValues();
  85. };
Oct 11 '07 #3
Banfa
9,065 Expert Mod 8TB
Line 19 you have { where you need }
Oct 11 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old...
1
by: the_proud_family | last post by:
HELP ME PLEASE!! my email is the_proud_family@yahoo.com I can't get the ball to go up right side and then I need it to turn around and keep turning until velocity=0 I have been at it for the ...
0
by: Kurt Watson | last post by:
I’m having a different kind of problem with Hotmail when I sign in it says, "Web Browser Software Limitations Your Current Software Will Limit Your Ability to Use Hotmail You are using a web...
12
by: Christo | last post by:
borland c++ 5.01 character constant must be one or two characters long get this when compiling my first c++ program can anyone out there help? it is highlighting this line as the problem ...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
5
by: Craig Keightley | last post by:
Please help, i have attached my page which worksin IE but i cannnot get the drop down menu to fucntion in firefox. Any one have any ideas why? Many Thanks Craig ...
17
by: JT | last post by:
Help me the following C++ question: Write a program to help a local bookshop automate its billing system. The program should do the following: (a)Let the user enter the ISBN, the system will...
7
by: tyler_durden | last post by:
thanks a lot for all your help..I'm really appreciated... with all the help I've been getting in forums I've been able to continue my program and it's almost done, but I'm having a big problem that...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
2
by: =?Utf-8?B?U2NvdHRSYWREZXY=?= | last post by:
I'm creating a doc project for my c# program. I've done this before but this time sonething is wrong. I build my doc project and is succeeds but when I open the help file, there is no documentation...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.