Skip to main content
Filter by
Sorted by
Tagged with
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
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
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
0 votes
1 answer
59 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
-1 votes
2 answers
89 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
-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
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
0 votes
1 answer
60 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
0 votes
2 answers
583 views

I thought I knew a bit of Python, but then I stumped on this (a distilled form follows): class A: @staticmethod def f(): print('some code here to report exactly who ...
sl2c's user avatar
  • 11
0 votes
1 answer
94 views

I know that it is possible to define static methods in Java interfaces that are bound to the interface itself. However, I would like to define the signature of a static method to be implemented by ...
pbp's user avatar
  • 59
-2 votes
1 answer
107 views

With extension method, it is possible to add function that you call an instance. public static class MyExtensions { public static bool MyNewExtension(this String s) { return true; }...
gbs69's user avatar
  • 35
0 votes
1 answer
67 views

This is not quite the same as this question, which itself is unanswered. I want to call get the tableName from inside an instance when the instance is an interface. Currently, I have it as an instance ...
Richard Haven's user avatar
0 votes
0 answers
30 views

class Solution { private: static bool cmp(const int& a, const int& b) { return a >= b; } public: long long function(vector<int>& nums) { sort(nums....
Shashank Bhari's user avatar
0 votes
1 answer
115 views

In JAVA CompletableFuture is a class which contains a static method named supplyAsync() I can call this static method using CompletableFuture.supplyAsync() pattern but I am unable to call the static ...
tanmay badhe's user avatar
0 votes
2 answers
259 views

I want to update our current project that runs on PHP 7.2 but I got an issue that I cant resolve easily. public function getCategories($type){...} //In another file that dosent implements Category $...
user20562805's user avatar
0 votes
1 answer
79 views

What is the practical difference between instance methods and static methods, since these two codes return the same results? I understand that static methods do not operate on ‘self’ and do not have ...
Mateusz Srebniak's user avatar
0 votes
2 answers
82 views

Suppose I have two classes A and B, where B inherits from A. A and B both have a bar method. A has a foo method which is inherited by B. I now want bar from A to be called whenever foo is called, ...
AimLow's user avatar
  • 125
-2 votes
1 answer
71 views

the function f in 2.o have global scope, and 1.c if he wanted he could use it. but in 1.o have unique definition of f. the linker agree to accept it though How is there no conflict here and which ...
abu fadi's user avatar
1 vote
0 answers
91 views

I really like the syntax of "named constructors," which I understand to be static methods that return the object hosting them? (I apologize if "named constructors" isn't the right ...
Anne Quinn's user avatar
  • 13.1k
0 votes
1 answer
215 views

I'm currently write a method that read data consecutively from serial port in C# winform for .NET framework. I write an event handler for it, but since its static, i cannot call variable from outside. ...
zyp8x's user avatar
  • 27
0 votes
1 answer
48 views

I've started learning Python recently and got this code here: import math class Circle: def __init__(self, radius): self.radius = radius def area(self): return math.pi * self....
JerryWest's user avatar
-1 votes
1 answer
33 views

Just like stated in title, is it possible to implement such functionality in java? Thanks. Suppose I have a class myClass.java, is it possible to achieve below functionality public class myClass { @...
lalala's user avatar
  • 1
-1 votes
1 answer
143 views

In object-oriented programming, an "invoker" refers to an object or code that initiates/invokes the execution of a method or function on another object. But my question is what if a class ...
Swapnil Mishra's user avatar
0 votes
0 answers
27 views

I am using boto3 library to establish connection to an s3 compatible storage. I had created a class with constructor that take cluster details, access key & IDs as inputs, having these initiated. ...
vpothurajula's user avatar
1 vote
0 answers
92 views

I am trying to create "plugin" factory. When an user requests creation of an object factory queries it's child factories and picks suitable one to create the object. Instances of child ...
KajzerSoze's user avatar

1
2 3 4 5
57