下面程序给出了一个从普通的基类派生出一个模板类的方法,在答题纸上填上缺少的部分。
#include ﹤iostream﹥
using namespace std;
class Base
{
public:
Base(int a){x=a;}
int Getx( ){return x;
void showb( ){cout﹤﹤x﹤﹤endl; private: int x;
};
template﹤class T﹥
class derived: public Base
{
public:
derived(T a, int b): _________
{ y=a; }
T Gety( ){ return y; }
void showd( ){cout﹤﹤y﹤﹤" "﹤﹤Gets( )﹤﹤endl;
private:
_________
};
void main( )
{ Base A(458);
A. showb( );
derived ﹤char *﹥B("It is",1357);
B.showd( );
}