#include <iostream> using namespace std; class Base { public: virtual void Method() = 0 { n = 1; } private: int n; }; class D1 :Base {}; class

Thùyy Nhungg

New member
#include <iostream>
using namespace std;
class Base
{
public:
virtual void Method() = 0 { n = 1; }
private:
int n;
};
class D1 :Base {};
class D2 :public D1
{
int i;
void Method() { i = 2; }
};
int main()
{
D2 test;
return 0;
}</blockquote>
What is wrong in the following code?
A. There is no error
B. There is a syntax error in the declaration of “Method”
C. Class D2 does not have access to “Method”
D. Class D1 must define “Method”