Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

bilsa

automatic dummy impl of interface?

This topic is 5139 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys! I''m wondering if there is any way, maybe with macros or templates to automatically implement a dummy of an interface. Like this: class ISomeInterface { public: virtual void test() = 0; }; class SomeInterfaceDummy : public ISomeInterface { public: virtual void test() {} }; There I created the SomeInterfaceDummy manually. Is there any way of doing this by a macro/templates? c ya!

Share this post


Link to post
Share on other sites
Advertisement
Not really...unless you want to use some script that will analyse the header files and generate a dummy implementation (using Perl, VB, etc).

It depends on what you want to use the dummy impl''s for, but you could do:


class ISomeInterface {
public:
virtual void test()
#if defined(DUMMY)
{ }
#else
= 0;
#endif
};


This means that if DUMMY is defined, then ISomeInterface can be used as the dummy interface, but if DUMMY is not defined you will be forced to derive from it.

Again, I''m not sure how useful that would be. Why do you want to generate dummies for your interfaces?

Regards,
Jeff



[ CodeDread ]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!