#include
using namespace std;
#include
The class Shape {
Public:
Virtual float getArea ()=0;
Virtual ~ Shape () {}};
The class Circle: public Shape
{public:
Int r;
Public:
Circle (int r)
{this - & gt; R=r. }
Virtual float getArea ()
{return (float) 3.14 * r * r; }
};
Class a Rectangle: public Shape
{public:
Int length;
Int wide; Public:
A Rectangle (int length, int wide)
{
This - & gt; Length=length;
This - & gt; Wide=wide; }
Virtual float getArea ()
{return (float) length * wide; }
};
The class Square: public Rectangle
{public:
Square (int wide) : a Rectangle (wide, wide)
{}
Virtual float getArea () {
Return (float) wide * wide; }
};//your code will be embedded in here
Int main ()
{Shape * ps; Ps=new Circle (5);
Cout & lt; <"The area of The Circle is" & lt;
A Rectangle * pr;
Pr=new Rectangle (5, 6);
Cout & lt; <"The area of The Rectagle is" & lt;
Square s (8);
Pr=& amp; s;
Cout & lt; <"The area of The Square is" & lt;
return 0;
}
//Output://Sample Output
The area of The Circle is 78.5
The area of The Rectagle is 30
The area of The Square is 64
CodePudding user response:
Linux:Process exit would have a "core" in the current directory files or form such as' core. The digital files such as' core. 1234 '
Using the command
GDB to run the program of the core or the core. The digital
Enter the GDB and then use the bt command
Can view the process exit before the function call stack, content is from the top to the following out of from the inner to outer function call history,
If process exit does not produce the core file, the reference "ulimit -c size the most large core file" command
Windows:
Collapsed in the pop-up dialog box, press the corresponding button to enter debugging press Alt + 7 key to view the Call Stack, namely "the Call Stack" from the inside to the following out of from the inner to outer function Call history, double-click a row to the cursor to the Call of the source code or assembly instruction, don't understand when double click on the next line, until we can read ,
CodePudding user response: