You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling constructor of a class within a module requires explicit importing of the module. It should work without importing the module as both the module and the code using it is present within the same file.
Snippet 1:
module M {
class A {
procA(a:int) {
writeln("hello");
}
}
}
var obj =new M.A(23);
Snippet 2:
module M {
class A {
procA(a:int) {
writeln("hello");
}
}
}
use M;
var obj =new M.A(23);
Calling constructor of a class within a module requires explicit importing of the module. It should work without importing the module as both the module and the code using it is present within the same file.
Snippet 1:
Snippet 2:
Running Snippet 1 gives the error
"error: unresolved call 'A.init(23)
whereas Snippet 2 runs fine.The text was updated successfully, but these errors were encountered: