🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

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

Started by
0 comments, last by Miss 6 years, 10 months ago

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!

This topic is closed to new replies.

Advertisement