this

Is there a "this" keyword in Ada?

Specifically, is there a way for a task to get a reference to itself? For example: task type someTask; type someTaskAccessor is access someTask; task body someTask is pointerToTask : someTaskAccessor; begin pointerToTask = this; end someTask; ...

Why self::function() and $self->variable or self::$variable even though there is $this->function() and $this->variable (PHP)?

I'm confused about these two keywords and the way to use them in PHP5. I think that "this" is used for instanced objects (not static) while "self" is referring to the object itself, not an instance of it and thus used within static objects. Right? Now, I believe that the correct use inside a class's static method to call another static ...

[PHP] Is there an equivalent to $this for static classes? ( kind of super but for the current class where it is used )

I know it wouldn't be exactly equivalent to $this, but is there a way to reference a static class from within itself without using the name of the class itself? ( like super but for itself ) This is just a way to avoid having to refactor all the class references if the class is renamed. Example: class foo { function bar() { static_this...

Speed difference: separate functor VS operator() inside a big class with *this

I'm using the c++ STL heap algorithms, and I wrote a wrapper class around it so I could do some other stuff. When I tried to use the code below, for example: //! Min-heap wrapper class. class FMMHeap{ public: FMMHeap(Vector &phi) : _phi(phi) {} bool operator()(unsigned p1, unsigned p2) {return fabs(_phi(p1)) > fabs(_phi(p2)); }...

In javascript, how can I tell what object a function is bound to (ie, its 'this') without calling it?

Does anybody know? Couldn't find this question asked before, even though it seems fairly basic. ...

Is there a difference between using "this" and "prototype" in Javascript here?

Hi, Is there a difference between the two codes below, I presume not. function Agent(bIsSecret) { if(bIsSecret) this.isSecret=true; this.isActive = true; this.isMale = false; } and function Agent(bIsSecret) { if(bIsSecret) this.isSecret=true; } Agent.prototype.isActive = true; Agent.prototype.isMale =...

a basic javascript class and instance using jquery "$(this)" for XML parser

I am (slowly) writing an XML parser for some "site definition" files that will drive a website. Many of the elements will be parsed in the same manner and I won't necessarily need to keep the values for each. The XML The parser so far My question is actually pretty simple: How can I use jquery manipulators in an class function? How ca...

Why is 'this' not updating to refer to a new object?

I'm writing an online game which allows a user to progress from one puzzle to the next, and if the user makes mistakes, each puzzle has a start again button to allow the user to start just that puzzle from scratch. A simplified version of the code's structure is below: function puzzle(generator) { this.init = function() { t...

this, current context-when should I use in jQuery?

Hi All, I am not very sure with the use of "this" [current context] in jquery.What I know is- it prevents the dom from searching all the elements, it just work on that current element, which improve performance[correct me if I am wrong].Also I am not sure when to use this and when not. lets say, should I go for $("span",this).slice(5...

addEventListener and the scope of this

I have a third party flash object which i can manipulate through a javascript API they provided. I am tryind to listen to an event on this object and then fire event inside my object to further bubble up the event. I happen to being using EXT Js but i dont think its important here. Sample code this.chart.addEventListener('create', fu...

Accessing an outer class from inside a listener?

I have a listener inside Class A, and I want to pass Class A to my Class B inside the listener. Normally I'd just use this, but then I'd get the event that triggered the listener. ...

c++: Object's variable cannot be evaluated, but variable from reference to the same object can???

Ok, this is veeery weird... I think. What I mean with the title is: inside the act() function from an actionHandler object I have: state->getHumanPieces(); Which gives me an address violation of some sort, apparently 'this' does not have a 'state' variable initialized... It so happens this actionHandler class has a static variable, w...

"this" keyword in IE

So, I using this snippet <tr onclick="this.toggleClassName('selected')"> on a web page. (a Prototype.js function) It works great. All I do is click on a table row, and it appears to get selected. It works everywhere, except IE and Opera. This is just a convenience, so I don't really care if it works, but in IE it throws an error, and a...

C# using the "this" keyword in this situation?

Hi, I've completed a OOP course assignment where I design and code a Complex Number class. For extra credit, I can do the following: Add two complex numbers. The function will take one complex number object as a parameter and return a complex number object. When adding two complex numbers, the real part of the calling object is adde...

Java: Abstract class constructors and this()

I feel like I'm missing something here; can someone point out what I'm misunderstanding?! I've got two classes, an Abstract and a Concrete, as follows: public abstract class Abstract { protected static int ORDER = 1; public static void main (String[] args) { Concrete c = new Concrete("Hello"); } public Abs...

What's wrong with this $(this).attr("id").toggle("");

What is the proper syntax for toggling the this.id object $(this).attr("id").toggle(""); Thanks. Google is surprisingly not helping :( ...

constructor and variable names in c++ vs java

Hi All, I'm learning c++ coming from a java background (knowing a little C from many years ago)... in Java, it's common practice to use "this" inside a constructor to distinguish the variable passed in as arguments to the constructor from the one declared in the class: class Blabla { private int a; private int b; Blabla(i...

PHP: Does $_this have a special meaning?

I cant seem to find any documentation on what $_this means in PHP. It seems to be used quite a bit in the CakePHP framework. Any ideas? ...

Where's the difference between self and $this-> in a PHP class or PHP method?

Where's the difference between self and $this-> in a PHP class or PHP method? Example: I've seen this code recently. public static function getInstance() { if (!self::$instance) { self::$instance = new PDO("mysql:host='localhost';dbname='animals'", 'username', 'password');; self::$instance-> setAttribute(PDO::ATT...

please help me with the my OOP PHP doubt?

I have the foll prog class Person { var $name; function Person () { } } $fred = new Person; $fred->name = "Fred"; $barney =& new Person; $barney->name = "Barney"; echo $barney->name; echo $fred->name; both the echo statements give the right same output ie "Fred" and "Barney" so whats the use of giving & while declaring $barne...