| | |
"this" keyword in OOP
Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
![]() |
•
•
Join Date: May 2009
Posts: 12
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 |
ai algorithm algorithms amazon assignment assignmenthelp assignments automata battery bigbrother binary bittorrent bletchleypark bomb business cern codebreaker compiler computer computerscience computertrackingsoftware connect conversion csc dataanalysis dataintepretation development dfa dissertation dissertations dissertationthesis dissertationtopic ebook employment energy floatingpoint foreclosure foreclosuresoftware fuel gadgets geeks givemetehcodez government graphics hardware history homeowners homeworkassignment homeworkhelp humor ibm idea internet iphone ipod itcontracts jobs kindle laser laws lsmeans mainframes marketing mobileapplication msaccess nano netbeans networking news os p2p piracy piratebay principles rasterizer research sam-being-cute sas science software spying stephenfry study supercomputer sweden technology textfield turing turingtest two'scompliment uk virus ww2






