static Questions
7
Solved
If I write something like this:
#include <iostream>
int main()
{
using namespace std;
{int n;n=5;} cout<<n;
system("pause");
return 0;
}
The compiler tells me that n is undecla...
5
Solved
I turned my C++ Dynamic link library into Static library just to acquire more knowledge.
My question is how can I use the .obj file to compile both projects with C# express/MS visual studio?
4
Solved
I'm tying myself in knots over a simple problem. I have a class that implements INotifyPropertyChanged. Some of the instance properties' getters use static properties and thus their values may chan...
Tarnetgaronne asked 30/1, 2013 at 21:31
4
Solved
I have some code like this:
static int a = 6;
static int b = 3;
static int Hello[a][b] =
{
{ 1,2,3},
{ 1,2,3},
{ 1,2,3},
{ 1,2,3},
{ 1,2,3},
{ 1,2,3}
};
But when I compile it, it says error...
2
Solved
This compiles:
class Node{
int m = 0;
static unsigned f(){
return 1;
}
public:
static unsigned a;
static unsigned b;
};
unsigned Node::a = sizeof(m); // <= !!!
unsigned Node::b = f(); /...
Expertism asked 24/8, 2023 at 8:23
20
Is it possible in C++ to have a member function that is both static and virtual? Apparently, there isn't a straightforward way to do it (static virtual member(); is a compile error), but is there a...
3
Solved
In an abstract base class if we have some static fields then what happens to them ?
Is their scope the classes which inherit from this base class or just the type from which it is inheriting (each...
6
Solved
It's not possible to use @Value on a static variable.
@Value("${some.value}")
static private int someValue;
static public void useValue() {
System.out.println(someValue);
}
When I do this, 0 i...
Genovera asked 1/8, 2011 at 10:34
28
I can't get my static files to come up. I've tried various settings and directory configurations and so on, but they just turn up as 404s. I have debug_toolbar installed so know that STATIC_URL is ...
Remy asked 9/10, 2012 at 22:38
22
Solved
I've written a factory to produce java.sql.Connection objects:
public class MySQLDatabaseConnectionFactory implements DatabaseConnectionFactory {
@Override public Connection getConnection() {
t...
Basilicata asked 14/1, 2014 at 3:8
17
Solved
I want to read strings from an xml file before I do much of anything else like setText on widgets, so how can I do that without an activity object to call getResources() on?
Lenten asked 8/12, 2010 at 20:3
6
Solved
I'd like to use a Calendar for some static methods and use a static field:
private static Calendar calendar = Calendar.getInstance();
Now I read java.util.Calendar isn't thread safe. How can I m...
Meld asked 5/6, 2011 at 18:51
1
Solved
I'm failing to programmatically initialize a static constexpr std::array member.
This is a minimal example of my issue (for simplification size is known and small, thus initialization could be manu...
Affer asked 7/7, 2023 at 16:39
5
Solved
How does [ThreadStatic] attribute work? I assumed that the compiler would emit some IL to stuff/retrieve the value in the TLS, but looking at a disassembly it doesn't seem to do it at that level.
...
Solubility asked 8/3, 2011 at 2:34
8
Solved
How to write static constructor in Dart?
class Generator
{
static List<Type> typesList = [];
//static
//{ /*static initializations*/}
}
Apophyllite asked 19/1, 2020 at 12:9
7
Solved
I'm trying to achieve some basic OOP in JavaScript with the prototype way of inheritance. However, I find no way to inherit static members (methods) from the base class.
We can simulate the basic ...
Vitkun asked 26/3, 2011 at 9:39
6
I haven't been able to find a concise chunk of code that allows me to add/display tooltips to a CStatic (and CLed) control. Obviously, the standard code to do so does not apply for this type of con...
4
Solved
In Swift, let's say I want to add a static factory method that returns an instance:
class MyClass {
static func getInstance() {
return MyClass(someProperty);
}
}
But what if I don't want to w...
3
I guess this question is geared more towards the language-geeks.
I have the following class:
<?php
abstract class ScopeFactory
{
public static function doStuff()
{
}
}
Now, I'm able to c...
3
Solved
static char* theFruit[] = {
"lemon",
"orange",
"apple",
"banana"
};
I know the size is 4 by looking at this array. How do I programmatically find the size of this array in C? I do not want th...
21
Solved
I've seen the word static used in different places in C code; is this like a static function/class in C# (where the implementation is shared across objects)?
1
I had a look a this question Serving static content with a root URL with the Gorilla toolkit and used the answer from there successfully.
I, though, want to declare explicitly which file I want to...
2
Solved
I am working on a CLI for learning purposes. This CLI involves a filesystem and I'd like to declare some public and static (or constant) Path objects in a "filesystem" module so that othe...
7
Solved
We are currently working with java with kotlin project, slowly migrating the whole code to the latter.
Is it possible to mock static methods like Uri.parse() using Mockk?
How would the sample cod...
Resignation asked 10/4, 2018 at 20:31
5
Solved
Let's say I have a utility class DateUtil (see below). To use this method
a caller method uses DateUtils.getDateAsString(aDate). Would it be better to remove
the static modifier and make DateUtil a...
© 2022 - 2024 — McMap. All rights reserved.