like this:
if ($sth) make_private($this->method);
or maybe there's some other way to affect accessibility of methods ?
Problem is that I written a class where methods must be called once, so I need code to restrict access to given method from outside the class after this method was executed.
...
Hello,
Not sure what to call this post exactly. I want to mimic a structure I've seen in Facebook, but I'm not actually using Facebook, this was a good example. I remember from using the Facebook API that it had a method that did:
FB_RequireFeatures(<key>, <handler>)
This method essentially said if the feature was ready to go at the...
Say I have a method:
public void SomeMethod(String p1, String p2, int p3)
{
#if DEBUG
object[] args = GetArguments();
LogParamaters(args);
#endif
// Do Normal stuff in the method
}
Is there a way to retrieve an array of the arguments passed into the method, so that they can be logged?
I have a large number of meth...
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class A(object):
... def f(self):
... print self.k
...
>>> class B(object):pass
...
>>> a=A()
>>> b=B()
>>> a.k="a.k"
>>> b.k="b.k"
>>> a.f()
a.k
>>> A.f(a)
a.k
>>> A.f(b)
Trace...
I am a beginner so please forgive my ignorance.
In my app I have a lot of copy and paste code that is exactly the same and performs exactly the same function (button click events and the like). These redundant code live in the code-behind of many of my pages. So I decided to reduce the code duplication and to move these methods into a ...
I have an application service (ie. large method) responsible for coordinating the interaction between several business objects. Essentially it takes a DTO from one system which contains customer information and an invoice, and translates it and imports it into a different system based on various business rules.
public void ProcessQueue...
Why I can access to X variable from "method()" and not from Main() method?
class Program
{
int X; // this is the variable I want access
static void Main(string[] args)
{
int a;
a = X; // this doesnt work, but why?
}
void metodo()
{
int b;
...
Hi there,
I've created a static getter-function:
@implementation MyClass
static int aValue = 1;
+ (int) aValue { return aValue; }
// other stuff here
@end
and now I'm trying to access it in some different ways from another class:
@implementation AnotherClass
- (void) aMethod {
if (MyClass.aValue > 0) { NSLog(@"Foobar"); } //...
Hi everybody,
I want do be able do update some values direct form the index view of my subscription Resource.
To do so I try the following code:
subscription_path(subscription, :method => :put)
The problem is, that this goes directs to the show action as if the method would be :get!
Thanks for your help!
Maechi
...
I have feeling, that if one defines a method
def test
puts 'Hi'
end
then there is a class to which this method belongs to (i.e. Unknown#test). So one probably has a possibility to list all methods defined "outside" of other classes. Or there is another way to do such listing?
...
I am still pretty new to C# and am having a difficult time getting used to it compared to C/CPP.
How do you exit a function on C# without exiting the program like this function would?
if (textBox1.Text == "" || textBox1.Text == String.Empty || textBox1.TextLength == 0)
textBox3.Text += "[-] Listbox is Empty!!!!\r\n";
System.Enviro...
Hi.
Let's say I've got a Java object that's got among others the following methods:
public String getField1();
public String getField2();
public String getField3();
public String getField4();
public String getField5();
Is there a way to iterate through these methods and call 'em like the following code?
String fields = "";
for(int i...
Hi all,
I have a MethodInfo passed in to a function and I want to do the following
MethodInfo containsMethod = typeof(ICollection<>).GetMethod("Contains");
if (methodInfo.Equals(containsMethod)
{
// do something
}
But this doesn't work because the methodInfo has a specific generic type. For the example does work if I knew that th...
Hey guys,
I know there are a lot of questions on this topic already, but it is just not clear to me yet.
So, what I am still wondering about is, if I call a method and pass it an object, do I then have to retain this object inside my method to use it there. And if I retain it, where do I release it. Lets make a bit of a more complex exam...
There is a class
class A {
public:
A() {};
private:
void func1( int ) {};
void func2( int) {};
};
I want to add a function pointer which will be set in constructor and points to func1 or func2.
So I can call this pointer (as class member) from every class procedure and set this pointer in constructor.
How can I do it...
I've been going through some open-source code for a Twitter app, and came across this:
(in the OADataFetcher.h) file:
OAMutableURLRequest *request;
NSURLResponse *response;
NSError *error;
NSData *responseData;
(inside the 'fetchDataWithRequest:delegate:didFinishSelector:didFailSelector:' method) in OADataFetcher.m:
responseData = ...
Could someone explain to me what is the difference between class and instance of the class.
If I can use only one instance of the some class in the program, can I use the class like an instance and change all the (-) with (+) in the methods declaration. What is the difference between the class and instance methods. Thanks
...
Hello,
Is it possible to call a function by using the strings ?.
i.e i have a variable var target = 'next';. Using this string i want to call the jquery method next() . Should i use target + '()' (this is bit foolish) to call next() ???
I know it can be done using conditional statements. Since it is a var got from users, it is a heav...
Hey guys, lately I have been asking quite a few questions about memory management on the iPhone. Fortunately things are getting clearer. But I still struggle when it gets more complex: So is there something wrong with this in terms of memory mangement? My question and suggestions are in the comments...
//I get a text from a textfield
NS...
class A{
private:
int a;
public:
A() {a = 4;}
const int& random1() const {return a; }
//int& random2() const {return a; }
const int* random3() const {return &a;}
//int* random4() const {return &a;}
};
int main(){
A objA;
cout<<objA.random1()<<"\n";
cout<<*objA.random3()<<"\n";
}
random2() an...