If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

I would like to know how to prevent the program print out "Business", I'd like it to call the base class's static function. I have tried to changed MyClass* into void* but it still prints Business :grumpy:.
My challenge is to output "BusinessInterop" without any changes made to the polymorphic structure as designed. Thank you.

The BusinessInterop::func is a static function in BusinessInterop, and does nothing except instantiate an empty MyClass and print a message. So why didn't you just do that? There is no polymorphism involved in what you have, since MyClass isn't a base class to anything you posted

My challenge is to output "BusinessInterop" without any changes made to the polymorphic structure as designed. Thank you.

Let's say we figure out on a high-level what you really want to do (it has to be much more than what you described) -- what if there is no feasible way to accomplish what you want to do with the current way you've set this up? Or what if there is a superior way of doing things that you may never had thought of?

I would like to know how to prevent the program print out "Business", I'd like it to call the base class's static function. I have tried to changed MyClass* into void* but it still prints Business :grumpy:.
My challenge is to output "BusinessInterop" without any changes made to the polymorphic structure as designed. Thank you.

weird question...
you don't wan to change the polymorphic structure...
but you do want to change the polymorhic behaviour implied by that structure.

the real question is missing because you didn't post the code.
but... assuming you want Call to return something else.
Change xxxServiceTest::Call() to not call funx() but call BI::func() instead. the polymorphic structure will always cause funx() to call the most derived implementation of virtual func().

Re: Preventing execution of a function

In my project, I must change all user-defined types except share pointers (I don't know how to deal with sharepointers because no default constructor to exchange the defined type with void/void* in the STL) to void* in order to get polymorphic behaviors exhibited otherwise the base class's static methods are always called. Why void* ?
I'll get you a view tomorrow, I also need a satisfactory answer about this odd.

Re: Preventing execution of a function

In my project, I must change all user-defined types except share pointers to void* in order to get polymorphic behaviors exhibited otherwise the base class's static methods are always called.

Why did you name the base class function "func" the same as the derived class function "func"? In the base class it is a static member, while in the derived class, it is a non-static member.

The base class version plays absolutely no role in polymorphism, as it is a static function devoid of a this pointer. All you wound up doing is hide the static version of the function in the derived classes, and instead replaced a function with a function of the same name and made it virtual. Were you expecting the "func" in the base class to be related in some way via polymorphism to the "func" in the derived classes? Well, they're not related.

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.