阅读:1421回复:3
读DS代码时遇到的语法问题。。。
已知一类:
class InterruptDemoDevice:public KDevice { ...... public: InterruptDemoDevice(void); ..... .... protected: Kinterrupt m_interrupt; KFifo<TimeSTamp> m_TimeStompFifo; ..... .... }; 有下列构造 InterruptDemoDevice::InterruptDemoDevice(): KDevice(L"intrDemo0", FILE_DEVICE_UNKNOWN, L"intrDemo0", DO_BUFFERED_IO, ), m_interrupt(Isa,0,FLOPY_IRQ, Latstched, TRUE, FALSE ), m_TimeStampFifo(FIFOSIZE,Nonpagedpool) { m_File=0; m_pevent=NULL; m_bNottifyApp=TRUE; m_Dpcsetup(Link tocdpc),this); m_interuptcount=0; } ///////////////////////////////////////////////// 我的问题是有谁知道这种用法,是指构造. 我试着自已写过类似的结果没有成功 如下: class bass{ public: bass(int x, int y){cout<<"this is "<<x+y;} }; class bass1{ public: bass1(int t,int k); }; class derived:public bass{ public: derived(); protected: bass1 m_s; }; bass1::bass1(int t,int k){cout<<"this is bass1"<<t+k;} derived::derived():bass(3,4),m_s(4,5){cout<<"this is derived()\n"} int main(void) { derived t; return 0; } |
|
沙发#
发布于:2004-10-28 18:13
看了一下你的代码,没什么问题
只是有个小的语法错误,改正后执行正常呀 |
|
|
板凳#
发布于:2004-10-28 18:13
看了一下你的代码,没什么问题 #include "iostream.h" class bass { public: bass(int x, int y) { cout<<"1.this is "<<x+y; } }; class bass1 { public: bass1(int t,int k); }; bass1::bass1(int t,int k) { cout<<"\n2.this is bass1 "<<t+k; } class derived:public bass { public: derived(); protected: bass1 m_s; }; derived::derived(): bass(3,4), m_s(4,5) { cout<<"\n3.this is derived() \n"; } int main(void) { derived t; return 0; } |
|
|
地板#
发布于:2004-10-28 22:26
我也来看看
|
|