Hi!
what the difference between overriding a function and virtual functions?! im really stuck!![]()
for example i have this:
PHP Code:#include <iostream.h>
class one{
public:
one(){}
virtual void override(){
cout <<"virtual function one"<<endl;
}
};
class two: public one{
public:
two(){}
virtual void override(){
cout <<"virtual function two"<<endl;
}
};
int main ()
{ one test;
two test2;
test.override();
test2.override();
system ("PAUSE");
return 0;
}
and this:
what the difference between them?! they both show me the same output!PHP Code:#include <iostream.h>
class one{
public:
one(){
}
void override(){
cout <<"virtual function one"<<endl;
}
};
class two: public one{
public:
two(){
}
void override(){
cout <<"virtual function two"<<endl;
}
};
int main ()
{ one test;
two test2;
test.override();
test2.override();
system ("PAUSE");
return 0;
}
![]()
thanks!



LinkBack URL
About LinkBacks



