C++ Problem
-
Is it possible to call a specialized function of a base class ? I mean: class A { protected: virtual int f() { return -1; }; void DoFunc() { printf("\nValue: %d",f()); }; }; class B : public A { protected: virtual int f() { return 1; }; }; int main() { B Inst; Inst.DoFunc(); } Is it possible to get the class A to print 1 ?
-
Is it possible to call a specialized function of a base class ? I mean: class A { protected: virtual int f() { return -1; }; void DoFunc() { printf("\nValue: %d",f()); }; }; class B : public A { protected: virtual int f() { return 1; }; }; int main() { B Inst; Inst.DoFunc(); } Is it possible to get the class A to print 1 ?
Alois Kraus wrote: Is it possible to get the class A to print 1 ? not in a forum where programming questions aren't allowed, no. -c
If Ben Affleck is sexy, then the terrorists have won. --Sheerly Avni
-
Is it possible to call a specialized function of a base class ? I mean: class A { protected: virtual int f() { return -1; }; void DoFunc() { printf("\nValue: %d",f()); }; }; class B : public A { protected: virtual int f() { return 1; }; }; int main() { B Inst; Inst.DoFunc(); } Is it possible to get the class A to print 1 ?
Please post this question in the Visual C++ forum and make sure you at least make your member functions
public
ally accessible. :rolleyes: Regards, Alvaro
Well done is better than well said. -- Benjamin Franklin (I actually prefer medium-well.)
-
Please post this question in the Visual C++ forum and make sure you at least make your member functions
public
ally accessible. :rolleyes: Regards, Alvaro
Well done is better than well said. -- Benjamin Franklin (I actually prefer medium-well.)
Did already do that. But I bet You wont be able to solve the problem ;P;P;P
-
Did already do that. But I bet You wont be able to solve the problem ;P;P;P
-
He already did and sent me the answer. We just aren't going to share. Tim Smith I'm going to patent thought. I have yet to see any prior art.
:muahahahahaha: (where's that evil laugh emoticon when we need it?) :-) Regards, Alvaro
Well done is better than well said. -- Benjamin Franklin (I actually prefer medium-well.)
-
Did already do that. But I bet You wont be able to solve the problem ;P;P;P
Well, even if I can't, it'll still be your problem won't it? ;P;P;P Regards, Alvaro
Well done is better than well said. -- Benjamin Franklin (I actually prefer medium-well.)
-
Is it possible to call a specialized function of a base class ? I mean: class A { protected: virtual int f() { return -1; }; void DoFunc() { printf("\nValue: %d",f()); }; }; class B : public A { protected: virtual int f() { return 1; }; }; int main() { B Inst; Inst.DoFunc(); } Is it possible to get the class A to print 1 ?
The way I see it, one or more of the following applies:
- Your compiler is broken, thus you have to ask us.
- You haven't figured out how your compiler works.
- You get a kick out of asking a programming question in a non-programming forum.
- You have been struggling with this problem for weeks, and you finally solved it. So to show the world how great you are at C++, you hope to make us newbies pull our hair in agony trying to solve the problem.
If I would have had the ability to smooth talk like John Simmons, this post would have been less sarcastic and more to the point. -- standing so tall, the ground behind no trespassers, on every floor a garden swing, and another door she makes it clear, that everything is hers A place of abode, not far from here, Ms. Van de Veer
-
:muahahahahaha: (where's that evil laugh emoticon when we need it?) :-) Regards, Alvaro
Well done is better than well said. -- Benjamin Franklin (I actually prefer medium-well.)
:666::cool:
-
Is it possible to call a specialized function of a base class ? I mean: class A { protected: virtual int f() { return -1; }; void DoFunc() { printf("\nValue: %d",f()); }; }; class B : public A { protected: virtual int f() { return 1; }; }; int main() { B Inst; Inst.DoFunc(); } Is it possible to get the class A to print 1 ?