| | |
"this" keyword in OOP
Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
![]() |
•
•
Join Date: May 2009
Posts: 14
Reputation:
Solved Threads: 0
Hello
In many OOP languages "this"(or something similar) is used to point to current object. But i think its an object by itself. Here is what i found" polymorphic object which can point in different times to different object`s types"
I like to get some more information about this maybe some science article.
Thank you in advance.
In many OOP languages "this"(or something similar) is used to point to current object. But i think its an object by itself. Here is what i found" polymorphic object which can point in different times to different object`s types"
I like to get some more information about this maybe some science article.
Thank you in advance.
What more information could there possibly be??? As you already stated its just a pointer to the current c++ class object.
For example, here's the output of the following in c++. It shows that the this pointer is the same in both child and parent.
For example, here's the output of the following in c++. It shows that the this pointer is the same in both child and parent.
A: this = 2afc38 B: this = 2afc38 Press any key to continue . . .
class A
{
public:
A()
{
x = 0;
cout << "A: this = " << hex << (unsigned int)this << "\n";
}
private:
int x;
};
class B : public A
{
public:
B()
{
y = 0;
cout << "B: this = " << hex << (unsigned int)this << "\n";
}
private:
int y;
};
int main(int argc, char* argv[])
{
B b;
}![]() |
Similar Threads
- problem with links in pagination (PHP)
- Any keyword to break or continue a LOOP like as in C "break","continue" keawords?? (PHP)
- google "keyword" question (Search Engine Optimization)
- "Citix" Keyword (Search Engine Optimization)
Other Threads in the Computer Science Forum
- Previous Thread: A thesis topic
- Next Thread: Final Year Project Ideas
| Thread Tools | Search this Thread |
Tag cloud for Computer Science
ai algorithm algorithms amazon assignment assignmenthelp assignments automata battery bigbrother binary bittorrent bizarre bletchleypark blogging business cern clueless compiler computer computers computerscience computertrackingsoftware connect conversion csc data dataanalysis development dfa dissertation dissertations dissertationthesis dissertationtopic ebook employment energy floatingpoint foreclosuresoftware fuel gadgets geeks givemetehcodez government graphics hardware history homework homeworkassignment humor ibm idea ideas internet iphone ipod itcontracts jobs kindle laser laws lazy lsmeans marketing mining mobileapplication msaccess netbeans networking news os p2p parser piracy principles programming rasterizer research science security sex simulation software spoonfeeding spying student study supercomputing sweden syntactic technology textfield tree turing turingtest two'scompliment uk virus warehouse ww2






