(10%) Determine
whether the following code has syntax errors or not. If
it is correct, predict its output. If it is incorrect, point out
the mistake(s).
// Virtual Function
#include <iostream>
using std::cout;
class CBox
{
protected:
int volume;
public:
CBox(int v = 0): volume(v) {}
int Volume() { return volume; }
void ShowVolume() { cout << Volume() << '\n'; }
};
class CGlassBox: public CBox
{
public:
CGlassBox(int v = 0): CBox(v) {}
int Volume() { return 0.25*volume; }
};
int main()
{
CBox myBox(24);
CGlassBox yourBox(24);
myBox.ShowVolume();
yourBox.ShowVolume();
return 0;
}