Jump to content
  • Advertisement
Miss

Can't call base function if a class of the same name exists

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

Edit: Nevermind this post, this was already solved in the WIP version that we haven't applied yet.

See this code:

class Banana
{
	Banana()
	{
		print("Banana ctor..");
	}
}

class Foo
{
	Foo()
	{
		Banana();
	}

	void Banana()
	{
		print("Banana!");
	}
}

class Bar : Foo
{
	Bar()
	{
		super();
	}

	void Banana() override
	{
		/*
		INFO : Compiling void Bar::Banana()
		ERR  : Identifier 'Banana' is not a data type in namespace 'Foo' or parent
		ERR  : A cast operator has one argument
		ERR  : Identifier 'Banana' is not a data type in namespace 'Foo' or parent
		*/
		Foo::Banana();
	}
}

The errors are on Foo::Banana(). Changing the name of Foo::Banana and Bar::Banana do something else is the workaround for this.

I feel like I've reported a similar issue in the past which was fixed, but not sure where that thread is now. This is on the latest 2.31.2 version. (I haven't tried the latest WIP yet.)

Also, isn't the call to Banana() in the Foo ctor abiguous between Foo::Banana and Banana's ctor?

Edit: Actually, it seems like this exact issue was the one I reported earlier, and was fixed:

Perhaps this wasn't in 2.31.2 yet, and I'm just pointlessly double-reporting this.. I'm going to try the WIP verison, apologies!

Edited by Ansjh

Share this post


Link to post
Share on other sites
Advertisement

  • 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!