Skip to main content
0 votes
1 answer
59 views

I want to make an interface with some static methods for decorating instances or adapting them to other interfaces. However, Groovy 4.0.x gives an error when trying to do this, probably because it's ...
Choosechee's user avatar
2 votes
1 answer
109 views

I want to achieve something like this: interface Parent { static int hi() { return 1; } } class Child implements Parent { static int hi() { return 0; } } class Child2 implements Parent { ...
Jeremy Yoo's user avatar
1 vote
1 answer
76 views

I have the following interface which contains a static method definition: public interface IUpgradableDataSource { static abstract Task<JsonElement> UpgradeSourceConfigurationAsync( ...
Apollo3zehn's user avatar
0 votes
2 answers
209 views

The question is simply in the comment of code below By the way this code is valid only with C#-11 language version (ie: create a Net 8.0 framework project or later to test). Is the problem of code ...
Astyan's user avatar
  • 66
1 vote
2 answers
158 views

If I had to run functions in the global scope e.g. in order to populate a static container in several cpp-files, then each time such a function is invoked I would have to initialize a new variable as ...
cockatiel's user avatar
  • 104
1 vote
0 answers
34 views

According to the specification, are built-in Javascript static methods, like Array.from, Object.assign, console.log, etc meant to be bound or do they need to be invoked via the constructor/object? ...
Aayla Secura's user avatar
0 votes
1 answer
65 views

I have WebSocket server: @ServerEndpoint(value = "/demoApp") public class MyWebSocketServer { @OnMessage public String onMessage (String message, Session session) throws IOException {...
Okneas's user avatar
  • 21
2 votes
1 answer
181 views

Given a function which is a staticmethod of a class, is there a way to extract the parent class object from this? class A: @staticmethod def b(): ... ... f = A.b ... assert ...
oliversm's user avatar
  • 1,987
-1 votes
2 answers
93 views

Java shouldn't allow static methods within an inner class and yet this code compiles and runs. How is this possible? class Test{ static int j=20; public void m1() { class Inner{ ...
abhay chanana's user avatar
0 votes
1 answer
120 views

How do you define a static constructor within a JS class? I managed to write something that somehow works but it requires to write a specific codepath in constructor for when an IngredientsDB object ...
Fravadona's user avatar
  • 17.6k
-2 votes
1 answer
61 views

I'm looking for a solution that would allow me to have access to a static function that would operate on instanced values without implementing a singleton. I'm not sure it's possible, I've personally ...
Grim_T's user avatar
  • 145
0 votes
1 answer
106 views

I'm working with a priority_queue in C++ and encountered a problem when using a static member function as a custom comparator within a class. A reproducible example will be: #include <bits/stdc++.h&...
DanielRicky's user avatar
5 votes
2 answers
83 views

I have a scenario where I have objects with static methods. They are all built using an outside def build_hello() as class variables. def build_hello(name: str): @staticmethod def hello_fn(): ...
Coldchain9's user avatar
  • 1,767
1 vote
1 answer
95 views

Consider this: struct Base { static Base make() { return {}; } }; struct Derived : public Base { // I _would_ want to have a `static Derived make()` automagically here }; One approach to the ...
Misha's user avatar
  • 535
0 votes
1 answer
62 views

In Unity C#, I have a base class Baker, it's derived from ScriptableObject, and I'm deriving from it CakeBaker, BreadBaker, PieBaker. ScriptableObjects can only be created statically, using ...
TheUmpteenth's user avatar

15 30 50 per page
1
2 3 4 5
189