Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Virtual function with different number of arguments

$
0
0

I thought it is allowed to have different number of arguments in virtual functions between base & derived class.  But I kept getting this error:  ">c:\cygwin\home\wly\virtault\virtualtest.cpp(44): error C2660: 'Window::Create' : function does not take 1 arguments".  Thanks in advance

class Window {

public:  virtual void Create()....

}

class Comp:public Window {

public: virtual void Create(int i)...

}

void main() {

Window *z;

int i=500;

z=new Window();

z->Create(i);

....

}


Viewing all articles
Browse latest Browse all 15302

Trending Articles