Ordinary functions can override internal constructor access functions
See original GitHub issueOn the JS backend, a constructor compiles to a function with a name like Classname_constructorname
. If you manually declare a function with that name after the class, it overrides the constructor function.
class C of c {
shared new c {}
}
void \iC_c() {
print("boom!");
}
shared void run() {
print(C.c);
}
$ ceylon compile-js,run-js tmp Note: Created module tmp/1.0.0 boom! <null>
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Calling virtual functions inside constructors - Stack Overflow
[...] In a constructor, the virtual call mechanism is disabled because overriding from derived classes hasn't yet happened. Objects are constructed from the ......
Read more >Access Modifiers - C# Programming Guide - Microsoft Learn
All types and type members in C# have an accessibility level which controls whether they can be used from other code.
Read more >Class inheritance - The Modern JavaScript Tutorial
We can override not only methods, but also class fields. Although, there's a tricky behavior when we access an overridden field in parent ......
Read more >Contracts — Solidity 0.8.17 documentation
Internal functions can only be accessed from within the current contract or contracts deriving from it. They cannot be accessed externally. Since they...
Read more >Virtual Function in C++ - GeeksforGeeks
They are always defined in the base class and overridden in a derived class. It is not mandatory for the derived class to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
feature?
ok now it’s done.