Hi
I'm studying for my test in C and i've encountered a question which i can't figure its answer.
A programmer wrote a program to count number of users (Count.h, Count.c):
/******** FILE: Counter.h ***********/
static int counter = 0;
int getUsersNum ();
/******** END OF FILE: Counter.h ****/
/******** FILE: Counter.c ***********/
#...
I'm trying to interface a c++ member function with a legacy C library taking a function pointer - I can't see why this keeps coming up with link errors, Can anyone see why ?
link errors
/tmp/ccl2HY1E.o: In function `VerifyWrapper::verifyGlue(int)': callback.cpp:(.text._ZN13VerifyWrapper10verifyGlueEi[VerifyWrapper::verifyGlue(int)]+0xe...
Hy there i a beginner in java started 3 weeks ago, im having some problems with this code.
in the main method i have an array containing 10 elements.
i've already made several methods to like
public static void println(int[] array) ------ to print and array
public static boolean isPrime(int el) ----------- prime test. returns tru...
Hi,
I'm trying to figure out the correct way of initializing a static container variable whose template value is a private inner class. Here's a toy example
#include <vector>
using namespace std;
template <class myType>
class Foo {
private:
class Bar {
int x;
};
static vector<Bar*> bars;
};
template <class myT...
I understand that one benefit of having static member functions is not having to initialize a class to use them. It seems to me that another advantage of them might be not having direct access to the class's not-static stuff.
For example a common practice is if you know that a function will have arguments that are not to be changed, to...
I'm studying dynamic/static scope with deep/shallow binding and running code manually to see how these different scopes/bindings actually work. I read the theory and googled some example exercises and the ones I found are very simple (like this one which was very helpful with dynamic scoping) But I'm having trouble understanding how stat...
I have a Networking service that i want to use as a Service. It's a local Service since it's not valid anymore once the application process is dead and no Other applications need to access it.(or should...).
I was pondering if to use the IBinder interface with local reference to the class and decided not to, for the moment.
I have the ...
Hi, I have a pretty weird problem:
My Class looks like this
<?php
class asd {
private static $variable;
public static function blabla(){
self::$variable="blubb";
}
}
?>
When I'm trying to call asd::blabla() with the help of the __autoload function, everything works fine.
But when I'm trying to call it without a...
hello I'm new to PHP and I need help to understand the basics of PHP class.
I want to have example of a class that uses private public protected and static.
and how do they work..
Thanks in advance.
Oh I forgot how to extends also.
I'm talking about the parent and child something or what..
Thanks again.
...
I'm trying to implement a category of an existing class.
There is a static variable in the existing class.
If I try to access the static variable from a category, I'm getting
an error that the static variable is undeclared.
Is it possible to access static variables in ObjC Categories ?
...
Hi,
i've got a class
public class Preferences extends PreferenceActivity implements OnSharedPreferenceChangeListener
out of this i try to call a method from an other class, this method contains:
mFoo.setTextColor(getResources().getColor(R.color.orange))
But it doesnt work, it tells me, getResources isnt static... how can i change?
...
A collegue of mine claims that in C# having static members in non-static classes prevents instances of those classes from ever being garbage collected and that this is a common source of C# memory leaks. As a result he always wraps static members in a static class and gains access to them from there via a static property or method(s) on ...
I'm maintaining an application that consumes a common library that
has a static instance of a class(ClassWrapper). This class is a basically a wrapper around the
Microsoft patterns and practices's CacheManager (v3.1 of the EL)
The library is hosted in a web application and also in a windows service app,
(both are inherently multi thre...
Is there a way in a C# static method to refer to the Type the method is defined in?
In an instance method you can determine the type by:
public void Foo()
{
Type type = this.GetType();
}
how would it look like in a static method?
public static void Bar()
{
Type type = ....?
}
Update: Sorry, clarification needed: I know the...
class foo
{
const bar;
}
and to access it we have to do: self:bar; and not, $this->bar;
Is this correct?
If so, why?
Thanks a lot,
MEM
...
Hi,
I have been reading articles about unnamed namespaces the whole day, most articles explained when you should use unnamed namespaces over the static keyword. But I am still left with one big question when is it appropriate to use static? After all it is not completely deprecated, what about header files with static functions should I...
Hi,
I want to display the context of a .txt file in an html file.
I know this would be very easy with PHP or javascript, but, to put you in context, I am building a content administrator for a Facebook page (Not app).
Facebook FBML is static and doest allow php and VERY limited javascript.
The first question would be if this is even...
I'm currently working on developing a personal Django site that will consist of various technologies / subdomains. My main page(s) will be Django, with a blog.blah.com subdomain that runs wordpress, and several other subdomains for projects (project1.blah.com, project2.blah.com), that are static HTML files (created with Sphinx).
I'm hav...
By "default" I mean just using the [Serializable] attribute on the class. I want to say that no, static fields would not be serialized, but I'm not exactly sure.
...
#include<stdio.h>
int main(void)
{
static int i=i++, j=j++, k=k++;
printf("i = %d j = %d k = %d", i, j, k);
return 0;
}
Output in Turbo C 4.5 :
i = 0 j = 0 k = 0
In gcc I'm getting the error:
Initializer element is not constant
Which one is logically correct ? I'm in bit confusion..
...