What does this symbol mean?
AirlineTicket::AirlineTicket()
The scope resolution operator ( :: ) is used for several reasons. For example: If the global variable name is same as local variable name, the scope resolution operator will be used to call the global variable. It is also used to define a function outside the class and used to access the static variables of class.
The :: operator is known as the scope resolution operator, and it is used to get from a namespace or class to one of its members. The . and -> operators are for accessing an object instance's members, and only comes into play after creating an object instance. You use .
Copyright: ©. When you write a "C" with a circle around the letter, or use the word "copyright," you are giving notice to the public that the work is copyrighted and that you are the owner of the work.
:: is the scope resolution operator - used to qualify names. In this case it is used to separate the class AirlineTicket from the constructor AirlineTicket(), forming the qualified name AirlineTicket::AirlineTicket()
You use this whenever you need to be explicit with regards to what you're referring to. Some samples:
namespace foo { class bar; } class bar; using namespace foo; Now you have to use the scope resolution operator to refer to a specific bar.
::foo::bar is a fully qualified name.
::bar is another fully qualified name. (:: first means "global namespace")
struct Base { void foo(); }; struct Derived : Base { void foo(); void bar() { Derived::foo(); Base::foo(); } }; This uses scope resolution to select specific versions of foo.
In C++ the :: is called the Scope Resolution Operator. It makes it clear to which namespace or class a symbol belongs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With