Ask your own question, for FREE!
Computer Science 18 Online
OpenStudy (anonymous):

could anyone tell plz that why only dot is used for denoting dot operator in c++?

OpenStudy (anonymous):

I'm confused, as opposed to what?

OpenStudy (anonymous):

Dot operator is sort of like the possive in English or another language. For instance, if X in a desk, then X's top surface might be X.topsurface. I'm using another similar language, not C++, as my reference re this usage, but believe that is right for C++ also. How does the possessive work in Hindi? Isn't it "ka"? Would "X ka desktop" be the way to say that in Hindi? If so, a direct equivalence to C++ syntax. Hope that little bit helps. Best wishes.

OpenStudy (anonymous):

1st sentence above, "possive" should be "possessive".

OpenStudy (anonymous):

the dot operator pretty much allows u to access fields of a structure or a class... for example u have a class: class MyClass{ public: int x; double y; } main() { MyClass exp; //if u want to access variable x that is related to object exp exp.x=5; //same thing for y exp.y=5.3; return 0;} PS. this is not the proper way to access class variables ((we usually do so with functions)) but it just for demonstrating the operator u can do the same thing with struct members ...hope this helped

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Breathless: Spooky witch but cute
4 hours ago 3 Replies 0 Medals
Arriyanalol: help
4 hours ago 10 Replies 2 Medals
Arriyanalol: @tinydinoUwU stop trying to find a argument u blad lil boy
1 day ago 5 Replies 4 Medals
Jaded012023: Please tell me what you all think of this song
7 hours ago 6 Replies 1 Medal
Arriyanalol: bro how
7 hours ago 2 Replies 3 Medals
Arriyanalol: cant wait for the new bluey movie in 2027
1 day ago 12 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!