I have something like this
When i try to call the print function from class man I get the print function from class pub..Code:class pub { public : void print(){cout<<-----<<endl;} }; class man:public pub { public: void print(){cout<<"----------------------"<<endl;} }; int main() { pub *p1; p1=new man; pub->print(); return 0 ; }
How can i fix this..
I cant make print virtual and I must use pub pointer I try with reintrepret_cast but it doesnt work



LinkBack URL
About LinkBacks


