What does the “::” mean in C++?2019 Community Moderator ElectionThe Definitive C++ Book Guide and ListWhy are begin(container) and end(container) accessible everywhere but aren't in global namespace?What are the differences between a pointer variable and a reference variable in C++?What does the explicit keyword mean?What are POD types in C++?The Definitive C++ Book Guide and ListWhat is the effect of extern “C” in C++?What is the “-->” operator in C++?What is the copy-and-swap idiom?What is The Rule of Three?C++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming?Why is it faster to process a sorted array than an unsorted array?
From an axiomatic set theoric approach why can we take uncountable unions?
How to resolve: Reviewer #1 says remove section X vs. Reviewer #2 says expand section X
How to write a chaotic neutral protagonist and prevent my readers from thinking they are evil?
Vocabulary for giving just numbers, not a full answer
Expressing logarithmic equations without logs
Do I really need to have a scientific explanation for my premise?
Virginia employer terminated employee and wants signing bonus returned
School performs periodic password audits. Is my password compromised?
Does "Until when" sound natural for native speakers?
How exactly does an Ethernet collision happen in the cable, since nodes use different circuits for Tx and Rx?
Minimizing with differential evolution
Finitely many repeated replacements
What is the generally accepted pronunciation of “topoi”?
Can we track matter through time by looking at different depths in space?
Doesn't allowing a user mode program to access kernel space memory and execute the IN and OUT instructions defeat the purpose of having CPU modes?
Professor forcing me to attend a conference, I can't afford even with 50% funding
For which categories of spectra is there an explicit description of the fibrant objects via lifting properties?
Why is there an extra space when I type "ls" in the Desktop directory?
Rationale to prefer local variables over instance variables?
In the late 1940’s to early 1950’s what technology was available that could melt a LOT of ice?
What is better: yes / no radio, or simple checkbox?
What materials can be used to make a humanoid skin warm?
How do we create new idioms and use them in a novel?
Is it possible that a question has only two answers?
What does the “::” mean in C++?
2019 Community Moderator ElectionThe Definitive C++ Book Guide and ListWhy are begin(container) and end(container) accessible everywhere but aren't in global namespace?What are the differences between a pointer variable and a reference variable in C++?What does the explicit keyword mean?What are POD types in C++?The Definitive C++ Book Guide and ListWhat is the effect of extern “C” in C++?What is the “-->” operator in C++?What is the copy-and-swap idiom?What is The Rule of Three?C++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming?Why is it faster to process a sorted array than an unsorted array?
What does this symbol mean?
AirlineTicket::AirlineTicket()
c++
add a comment |
What does this symbol mean?
AirlineTicket::AirlineTicket()
c++
6
The fact that you're asking the question suggests that you have not yet read a basic introductory book on C++ - you should probably make it a priority to do so before you get much further with learning the language.
– Paul R
Mar 17 '11 at 21:38
2
@Paul R: Exactly. Here's the book list: stackoverflow.com/questions/388242/…
– Fred Larson
Mar 17 '11 at 21:42
thanks @Fred Larson
– Milad Sobhkhiz
Mar 17 '11 at 21:47
2
@PaulR Not everyone who arrives upon this question is looking to learn C++. I, for example, just happened to be skimming some C++ code and wanted to get the general idea of what the program is doing and needed a quick reference :)
– Ebony Maw
Dec 16 '18 at 18:34
add a comment |
What does this symbol mean?
AirlineTicket::AirlineTicket()
c++
What does this symbol mean?
AirlineTicket::AirlineTicket()
c++
c++
edited May 8 '17 at 12:11
Mateusz Piotrowski
3,95063152
3,95063152
asked Mar 17 '11 at 21:33
Milad SobhkhizMilad Sobhkhiz
3994723
3994723
6
The fact that you're asking the question suggests that you have not yet read a basic introductory book on C++ - you should probably make it a priority to do so before you get much further with learning the language.
– Paul R
Mar 17 '11 at 21:38
2
@Paul R: Exactly. Here's the book list: stackoverflow.com/questions/388242/…
– Fred Larson
Mar 17 '11 at 21:42
thanks @Fred Larson
– Milad Sobhkhiz
Mar 17 '11 at 21:47
2
@PaulR Not everyone who arrives upon this question is looking to learn C++. I, for example, just happened to be skimming some C++ code and wanted to get the general idea of what the program is doing and needed a quick reference :)
– Ebony Maw
Dec 16 '18 at 18:34
add a comment |
6
The fact that you're asking the question suggests that you have not yet read a basic introductory book on C++ - you should probably make it a priority to do so before you get much further with learning the language.
– Paul R
Mar 17 '11 at 21:38
2
@Paul R: Exactly. Here's the book list: stackoverflow.com/questions/388242/…
– Fred Larson
Mar 17 '11 at 21:42
thanks @Fred Larson
– Milad Sobhkhiz
Mar 17 '11 at 21:47
2
@PaulR Not everyone who arrives upon this question is looking to learn C++. I, for example, just happened to be skimming some C++ code and wanted to get the general idea of what the program is doing and needed a quick reference :)
– Ebony Maw
Dec 16 '18 at 18:34
6
6
The fact that you're asking the question suggests that you have not yet read a basic introductory book on C++ - you should probably make it a priority to do so before you get much further with learning the language.
– Paul R
Mar 17 '11 at 21:38
The fact that you're asking the question suggests that you have not yet read a basic introductory book on C++ - you should probably make it a priority to do so before you get much further with learning the language.
– Paul R
Mar 17 '11 at 21:38
2
2
@Paul R: Exactly. Here's the book list: stackoverflow.com/questions/388242/…
– Fred Larson
Mar 17 '11 at 21:42
@Paul R: Exactly. Here's the book list: stackoverflow.com/questions/388242/…
– Fred Larson
Mar 17 '11 at 21:42
thanks @Fred Larson
– Milad Sobhkhiz
Mar 17 '11 at 21:47
thanks @Fred Larson
– Milad Sobhkhiz
Mar 17 '11 at 21:47
2
2
@PaulR Not everyone who arrives upon this question is looking to learn C++. I, for example, just happened to be skimming some C++ code and wanted to get the general idea of what the program is doing and needed a quick reference :)
– Ebony Maw
Dec 16 '18 at 18:34
@PaulR Not everyone who arrives upon this question is looking to learn C++. I, for example, just happened to be skimming some C++ code and wanted to get the general idea of what the program is doing and needed a quick reference :)
– Ebony Maw
Dec 16 '18 at 18:34
add a comment |
4 Answers
4
active
oldest
votes
:: 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.
add a comment |
In C++ the ::
is called the Scope Resolution Operator. It makes it clear to which namespace or class a symbol belongs.
add a comment |
It declares a namespace. So in AirlineTicket:: you can call all public functions of the AirlineTicket class and AirlineTicket() is the function in that namespace (in this case the constructor).
add a comment |
AirlineTicket is like a namespace for your class. You have to use it in the implementation of the constructor.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f5345527%2fwhat-does-the-mean-in-c%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
:: 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.
add a comment |
:: 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.
add a comment |
:: 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.
:: 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.
edited Mar 17 '11 at 21:40
answered Mar 17 '11 at 21:35
ErikErik
67.8k9173174
67.8k9173174
add a comment |
add a comment |
In C++ the ::
is called the Scope Resolution Operator. It makes it clear to which namespace or class a symbol belongs.
add a comment |
In C++ the ::
is called the Scope Resolution Operator. It makes it clear to which namespace or class a symbol belongs.
add a comment |
In C++ the ::
is called the Scope Resolution Operator. It makes it clear to which namespace or class a symbol belongs.
In C++ the ::
is called the Scope Resolution Operator. It makes it clear to which namespace or class a symbol belongs.
answered Mar 17 '11 at 21:36
maericsmaerics
106k29203251
106k29203251
add a comment |
add a comment |
It declares a namespace. So in AirlineTicket:: you can call all public functions of the AirlineTicket class and AirlineTicket() is the function in that namespace (in this case the constructor).
add a comment |
It declares a namespace. So in AirlineTicket:: you can call all public functions of the AirlineTicket class and AirlineTicket() is the function in that namespace (in this case the constructor).
add a comment |
It declares a namespace. So in AirlineTicket:: you can call all public functions of the AirlineTicket class and AirlineTicket() is the function in that namespace (in this case the constructor).
It declares a namespace. So in AirlineTicket:: you can call all public functions of the AirlineTicket class and AirlineTicket() is the function in that namespace (in this case the constructor).
answered Mar 17 '11 at 21:36
Benedikt WutziBenedikt Wutzi
153518
153518
add a comment |
add a comment |
AirlineTicket is like a namespace for your class. You have to use it in the implementation of the constructor.
add a comment |
AirlineTicket is like a namespace for your class. You have to use it in the implementation of the constructor.
add a comment |
AirlineTicket is like a namespace for your class. You have to use it in the implementation of the constructor.
AirlineTicket is like a namespace for your class. You have to use it in the implementation of the constructor.
answered Mar 17 '11 at 21:35
ChrisChris
3542416
3542416
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f5345527%2fwhat-does-the-mean-in-c%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
6
The fact that you're asking the question suggests that you have not yet read a basic introductory book on C++ - you should probably make it a priority to do so before you get much further with learning the language.
– Paul R
Mar 17 '11 at 21:38
2
@Paul R: Exactly. Here's the book list: stackoverflow.com/questions/388242/…
– Fred Larson
Mar 17 '11 at 21:42
thanks @Fred Larson
– Milad Sobhkhiz
Mar 17 '11 at 21:47
2
@PaulR Not everyone who arrives upon this question is looking to learn C++. I, for example, just happened to be skimming some C++ code and wanted to get the general idea of what the program is doing and needed a quick reference :)
– Ebony Maw
Dec 16 '18 at 18:34