How to make Dot function in c++? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

How to make Dot function in c++?

I see things like str.replace(5,2,ā€hiā€); But I donā€™t understand how the function was made if itā€™s not a class? Anyone know how?

14th Jun 2022, 5:49 PM
ITDW
2 Respostas
14th Jun 2022, 6:01 PM
Simon Sauter
Simon Sauter - avatar
+ 1
If a function is not a member of a class or struct, then you can invoke it directly by its name (and arguments - as necessary) without any need of the "dot". The "dot" is also known as member access operator https://en.cppreference.com/w/cpp/language/operator_precedence
15th Jun 2022, 3:49 AM
Ipang