Can anyone find the error in th following code? I keep getting these errors and
ID: 3658401 • Letter: C
Question
Can anyone find the error in th following code? I keep getting these errors and I'm confused as to why.
#include <iostream>
using namespace std;
class Sky
{
public:
Sky()
{ cout << "Entering the sky. "; }
Sky(string color)
{ cout << "The sky is " << color << endl; }
~Sky()
{ cout << "Leaving the sky. "; }
};
class Ground : public Sky
{
public:
Ground()
{ cout << "Entering the Ground. "; }
Ground(string c1, string c2) : Sky(c1)
{ cout << "The ground is " << c2 << endl; }
~Ground()
{ cout << "Leaving the Ground. "; }
};
int main()
{
Ground object;
return 0;
}
Explanation / Answer
you forgot to include your string library. #include//add this before using stringsRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.