• 15
• 15
• 11
• 9
• 10

# 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