Jump to content
  • Advertisement
Sign in to follow this  
Miss

Can't call base function if the function name is the same as a class name

This topic is 610 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

Here's a simple example that demonstrates the problem. Note how there is a class Cat, Foo, and Bar. There is no class named "Dog".
class Cat
{
}

class Foo
{
	int Cat()
	{
		return 0;
	}

	int Dog()
	{
		return 0;
	}
}

class Bar : Foo
{
	int Cat() override
	{
		return Foo::Cat(); // ERROR: Identifier 'Cat' is not a data type in namespace 'Foo' or parent
	}

	int Dog() override
	{
		return Foo::Dog(); // OK
	}
}
Edit: I forgot to set the prefix of the thread to Bug. Sorry about that! Edited by Ansjh

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!