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)
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.
/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)
Code:
#include "shape.h" #include <iostream> int Shape::getCenter_X() { cout << "In the Shape: get Center X" << endl; // Code for the withdraw function here return 1; } int Shape::getCenter_Y() { cout << "In the Shape get Center Y" << endl; // Code for showAllChecksCleared() function here return 1; } void Circle::printAllValues () { cout << "In the Circle print all values" << endl; } void Rectangle::printAllValues() { cout <<"In the Rectangle print all values" <<endl; }
Comment