+ 1

dot operator

obj.regVar=42; in friend keyword lessons what's that mean? regVar is not a function, how they use dot operator ?

27th Nov 2016, 1:15 PM
amir ramezanpour
amir ramezanpour - avatar
3 Answers
+ 2
you can assign "functions and values " to your objects by dot operator, there is no limit .
27th Nov 2016, 1:22 PM
parisa
parisa - avatar
+ 1
Basically, You can use the dot operator for a member variable or function of any struct or class in C++. For example, class Foo { public: int test; }; Foo bar; //We instantiate the class as object bar.test = 10; //Set the value of "variable test in //object bar of class Foo" to be 10
27th Nov 2016, 1:19 PM
Electrux
Electrux - avatar
+ 1
thanks a lot
27th Nov 2016, 1:22 PM
amir ramezanpour
amir ramezanpour - avatar