Jump to content
  • Advertisement
Miss

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

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