Note that there are some explanatory texts on larger screens.

plurals
  1. POerror: no matching function for call to 'Rectangle::Rectangle()'
    primarykey
    data
    text
    <p>I do not understand why this program is not working. I'm new to C++, switching after three years of Java. I thought the error messages in Java made no sense but the errors I've been getting in C++ have been just straight gibberish. This is one I can actually understand. </p> <p>Anyway so I have a program that has a Rectangle and Square Class. The square class inherits from the rectangle class. All my classes are all in different files.</p> <p>================================(main)</p> <pre><code>#include &lt;iostream&gt; #include "Rectangle.h" #include "Square.h" using namespace std; int main(){ Square sq; }//end main </code></pre> <p>================================(Rectangle.h)</p> <pre><code>#ifndef RECTANGLE_H #define RECTANGLE_H class Rectangle{ public: Rectangle (int, int); void setLength (int); void setWidth (int); int getLength (); int getWidth (); int getArea (); private: int length; int width; }; #endif // RECTANGLE_H </code></pre> <p>=================================(Rectangle.cpp)</p> <pre><code>#include &lt;iostream&gt; #include "Rectangle.h" #include "Square.h" using namespace std; Rectangle :: Rectangle (int len, int wid){ length = len; width = wid; }//end constructor void Rectangle :: setLength (int l){ length = l; }//end setLength void Rectangle :: setWidth (int w){ width = w; }//end setWidth int Rectangle :: getLength (){ return length; }//end getLength int Rectangle :: getWidth (){ return width; }//end getWidth int Rectangle :: getArea (){ return length * width; }//end getArea </code></pre> <p>========================================(Square.h)</p> <pre><code>#ifndef SQUARE_H #define SQUARE_H class Square : public Rectangle { public: Square(); }; #endif // SQUARE_H </code></pre> <p>====================================(Square.cpp)</p> <pre><code>#include &lt;iostream&gt; #include "Rectangle.h" #include "Square.h" using namespace std; Square :: Square { //super :: Square(4, 3); cout &lt;&lt; "This is bullshit"; }; </code></pre> <p>=======================================================</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload