Are the following comments all correct? Thanks in advance!
/*declaration and definition of myconst?*/
const int myconst = 4567;
/*declaration of myclass only?*/
class myclass;
/*definition of myclass?*/
class myclass
{
/*definition of mystatic?*/
static int mystatic;
/*declaration?*/
void mymethod();
};
/*initialization of mystatic?*/
int myclass::mystatic = 7890;
/*definition of mymethod?*/
void myclass::mymethod() { ... }
int main()
{
/*delcaration and definition of myobject?*/
myclass myobject;
return 0;
} 12 1250
eas wrote: Are the following comments all correct? Thanks in advance!
/*declaration and definition of myconst?*/ const int myconst = 4567;
/*declaration of myclass only?*/ class myclass;
/*definition of myclass?*/ class myclass { /*definition of mystatic?*/ static int mystatic; /*declaration?*/ void mymethod(); };
/*initialization of mystatic?*/ int myclass::mystatic = 7890;
/*definition of mymethod?*/ void myclass::mymethod() { ... }
int main() { /*delcaration and definition of myobject?*/ myclass myobject; return 0; }
It seems to me you're right...
-------------------------------------
#error in operator: add beer
"eas" <lp****@countrywide.att.net> wrote... Are the following comments all correct? Thanks in advance!
/*declaration and definition of myconst?*/ const int myconst = 4567;
declaration, definition, _and_ initialisation. /*declaration of myclass only?*/ class myclass;
Also known as "forward-declaration". /*definition of myclass?*/ class myclass { /*definition of mystatic?*/ static int mystatic;
No, declaration of 'mystatic'.
/*declaration?*/ void mymethod();
Yes. Most of the things inside a class definition are declarations.
};
/*initialization of mystatic?*/ int myclass::mystatic = 7890;
No, _definition_ _and_ initialisation of myclass::mystatic. /*definition of mymethod?*/ void myclass::mymethod() { ... }
Yes.
int main() { /*delcaration and definition of myobject?*/ myclass myobject;
Yes.
return 0; }
HTH
V
Victor,
"Victor Bazarov" <v.********@comAcast.net> wrote in message
news:KkgOb.76758$nt4.108224@attbi_s51... "eas" <lp****@countrywide.att.net> wrote... Are the following comments all correct? Thanks in advance!
/*declaration and definition of myconst?*/ const int myconst = 4567;
declaration, definition, _and_ initialisation.
/*declaration of myclass only?*/ class myclass;
Also known as "forward-declaration".
/*definition of myclass?*/ class myclass { /*definition of mystatic?*/ static int mystatic;
No, declaration of 'mystatic'.
/*declaration?*/ void mymethod();
Yes. Most of the things inside a class definition are declarations.
Can you give the examples of when things inside a class definition
are not declarations?
--The Direvtive };
/*initialization of mystatic?*/ int myclass::mystatic = 7890;
No, _definition_ _and_ initialisation of myclass::mystatic.
/*definition of mymethod?*/ void myclass::mymethod() { ... }
Yes.
int main() { /*delcaration and definition of myobject?*/ myclass myobject;
Yes.
return 0; }
HTH
V
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
The Directive wrote: Yes. Most of the things inside a class definition are declarations.
Can you give the examples of when things inside a class definition are not declarations?
Depends on what you define as 'thing', but e.g.
public:
is not a delcaration.
"The Directive" <th***********@hotmail.com> wrote... Victor,
"Victor Bazarov" <v.********@comAcast.net> wrote in message news:KkgOb.76758$nt4.108224@attbi_s51... "eas" <lp****@countrywide.att.net> wrote... Are the following comments all correct? Thanks in advance!
/*declaration and definition of myconst?*/ const int myconst = 4567;
declaration, definition, _and_ initialisation.
/*declaration of myclass only?*/ class myclass;
Also known as "forward-declaration".
/*definition of myclass?*/ class myclass { /*definition of mystatic?*/ static int mystatic;
No, declaration of 'mystatic'.
/*declaration?*/ void mymethod();
Yes. Most of the things inside a class definition are declarations.
Can you give the examples of when things inside a class definition are not declarations?
Yes, I can. Oh, did you mean to ask me to give such example?
class A {
class Nested {
int a;
};
};
The 'Nested' is a _definition_ inside the class A definition. More?
class A {
enum E { A, B, C };
};
'A', 'B', and 'C' are _definitions_ of enumerators inside the class A
definition.
Of course, one can have a member function _defined_ right there, in
a class definition, but you already knew that...
Victor
Victor Bazarov wrote: ... Can you give the examples of when things inside a class definition are not declarations?
Yes, I can. Oh, did you mean to ask me to give such example?
class A { class Nested { int a; }; };
The 'Nested' is a _definition_ inside the class A definition. More?
class A { enum E { A, B, C }; };
'A', 'B', and 'C' are _definitions_ of enumerators inside the class A definition.
Of course, one can have a member function _defined_ right there, in a class definition, but you already knew that... ...
Yes, but formally speaking the definitions given in your examples are
both definitions and declarations at the same time, while it appears
that the previous poster was looking for something that is not a
declaration. Although it could be just a bad wording on his part...
--
Best regards,
Andrey Tarasevich
"Andrey Tarasevich" <an**************@hotmail.com> wrote... Victor Bazarov wrote: ... Can you give the examples of when things inside a class definition are not declarations?
Yes, I can. Oh, did you mean to ask me to give such example?
class A { class Nested { int a; }; };
The 'Nested' is a _definition_ inside the class A definition. More?
class A { enum E { A, B, C }; };
'A', 'B', and 'C' are _definitions_ of enumerators inside the class A definition.
Of course, one can have a member function _defined_ right there, in a class definition, but you already knew that... ...
Yes, but formally speaking the definitions given in your examples are both definitions and declarations at the same time, while it appears that the previous poster was looking for something that is not a declaration. Although it could be just a bad wording on his part...
I seem unable to think of a definition that is _not_ simultaneously
a declaration. Can you name a couple? Thanks.
V
"Victor Bazarov" <v.********@comAcast.net> wrote in message
news:XoKOb.81860$Rc4.294424@attbi_s54... "Andrey Tarasevich" <an**************@hotmail.com> wrote...
Yes, but formally speaking the definitions given in your examples
are both definitions and declarations at the same time, while it
appears that the previous poster was looking for something that is not a declaration. Although it could be just a bad wording on his
part... I seem unable to think of a definition that is _not_ simultaneously a declaration. Can you name a couple? Thanks.
How about
void dog::bark() { std::cout << "woof!\n"; }
Jonathan
Victor Bazarov wrote: ... I seem unable to think of a definition that is _not_ simultaneously a declaration. Can you name a couple? Thanks. ...
I don't think I can, especially if we take into account the fact that
the defition of the term "definition" in the standard (3.1/2) begins
with "A 'declaration' is a 'definition' unless ..."
--
Best regards,
Andrey Tarasevich
Jonathan Turkanis wrote: > Yes, but formally speaking the definitions given in your examples are > both definitions and declarations at the same time, while it appears > that the previous poster was looking for something that is not a > declaration. Although it could be just a bad wording on his
part... I seem unable to think of a definition that is _not_ simultaneously a declaration. Can you name a couple? Thanks.
How about
void dog::bark() { std::cout << "woof!\n"; } ...
From the formal point of view, this is still a declaration. 7.1 refers
to 'function-definition' as one form of declaration. And
'function-definition' includes definitions of both standalone functions
and and member functions. Of course, this is not a self-sufficient
declaration, meaning that the function must also be declared in the
class definition, but declaration nevertheless.
--
Best regards,
Andrey Tarasevich
"Andrey Tarasevich" <an**************@hotmail.com> wrote in message
news:-L********************@comcast.com... Jonathan Turkanis wrote:
I seem unable to think of a definition that is _not_
simultaneously a declaration. Can you name a couple? Thanks.
How about
void dog::bark() { std::cout << "woof!\n"; } ...
From the formal point of view, this is still a declaration. 7.1
refers to 'function-definition' as one form of declaration. And 'function-definition' includes definitions of both standalone
functions and and member functions. Of course, this is not a self-sufficient declaration, meaning that the function must also be declared in the class definition, but declaration nevertheless.
Yeah, you got me. :( The standard implicitly states that all
definitions are declarations in 3.1/2.
Okay, I'll give it one last try:
#define THIS_IS_A_DIRECTIVE but also a definition ;-)
Jonathan
"The Directive" <th***********@hotmail.com> wrote in message
news:40********@corp.newsgroups.com... Can you give the examples of when things inside a class definition are not declarations?
Implicit inline functions for one:
class C
{
int f() { return 101; } // <- definition
};
- Risto - This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: middletree |
last post by:
I've been using CDO to send an email with an Intranet app I have. Can't for
the life of me remember where I got this code:
.Importance = 1 ' Normal
.BodyFormat = 1 ' Plain text
.MailFormat =...
|
by: Mike D |
last post by:
The code below gives an error.
Object doesn't support this property or method: 'myMail.Importance'
How do I set importance on an email? Everywhere I have looked it looks like
my syntax is right...
|
by: Neal |
last post by:
The rank of importance of CSS used to be:
Author !important rules
User !important rules
Author rules
User Rules
UA Settings
Now the rank is this:
|
by: Jason Kistler |
last post by:
I am having some serious issues trying to set the "importance" of an ASP
email. I am using the CDO.Message object. Here is the code:
<%
Dim recipients
recipients = Request.Form("Jason") &...
|
by: Kraig |
last post by:
Hi! I'm new to programming and am trying to figure out the best way
using loops, to compute pi to say, 14 terms using values that double
each time through the loop. As in, from 1-2-4-8-16, et al....
|
by: Mikey |
last post by:
This sample code demonstrates how to send an email message using CDO and
have it set the Outlook Importance property and the Outlook Follow Up
reminder attributes in the recipient's InBox.
The...
|
by: gen_tricomi |
last post by:
THE IMPORTANCE OF MAKING THE GOOGLE INDEX DOWNLOADABLE
I write here to make a request on behalf of all the programmers on
earth who have been or are intending to use the Google web search API...
|
by: Donny Riyadi |
last post by:
Hi all,
any idea, how to make a sql query, which the results can be ordered by
the importance ? FOr example if I search a table which contains a list
of meta tags of websites. I want, that the...
|
by: xahlee |
last post by:
I'd like to introduce a blog post by Stephen Wolfram, on the design
process of Mathematica. In particular, he touches on the importance of
naming of functions.
• Ten Thousand Hours of Design...
|
by: Whyatt |
last post by:
Hi all,
I'm trying to create a message using SMTP Mail through Python with a
message Importance of either 0 (Low) or 2 (High).
If I do outer.Add_header('Importance', '0') it is ignored.
If...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |