"Module is private" when calling function

Sean Eskapp eatingstaples at gmail.com
Fri Jan 7 03:54:29 PST 2011


I have two modules:

foo.d:
public void Foo(int x) {}
private void Foo(string x) {}

private void Bar(string x) {}
public void Bar(int x) {}

main.d:
import foo;

void main()
{
	Foo(5); // OK
	Foo("Hello"); // error: function is private (correct)
	Bar(5); // error: module is private (incorrect)
	Bar("hello"); // error: function is private (correct)
}

With the errors demonstrated. When a public function is denoted below a
private function, the private function seems to intercept the overload. Is
this supposed to happen?


More information about the Digitalmars-d mailing list