I understand that a const qualifier after the function declaration
makes it a const function for the class.
Like
int func1 const ( double, long int );
Now what is the purpose of the following
const int func1 const ( double, long int );
What is the purpose of the const before the declaration
-Parag 2 2711
<pa********@hot mail.comwrote in message
news:f0******** *************** ***********@i18 g2000prn.google groups.com...
>I understand that a const qualifier after the function declaration
makes it a const function for the class.
Like
int func1 const ( double, long int );
Actualy, it's like this:
int func1 ( double, long int ) const;
Now what is the purpose of the following
const int func1 const ( double, long int );
const int func1 ( double, long int ) const;
would be a constant function that returns a constant integer. Really not
making much sense, usually a const returned value is a reference or pointer
such as:
const int & func1 ( double, long int ) const;
or
const int* func1 ( double, long int ) const;
What is the purpose of the const before the declaration
On Jun 16, 7:44 am, "Jim Langston" <tazmas...@rock etmail.comwrote :
<parag_p...@hot mail.comwrote in message
news:f0******** *************** ***********@i18 g2000prn.google groups.com...
I understand that a const qualifier after the function
declaration makes it a const function for the class.
Like
int func1 const ( double, long int );
Actualy, it's like this:
int func1 ( double, long int ) const;
Now what is the purpose of the following
const int func1 const ( double, long int );
const int func1 ( double, long int ) const;
would be a constant function that returns a constant integer.
Really not making much sense,
Not much sense, since const-ness doesn't apply to rvalues of
non-class type. It is reasonable for a class type.
--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Blace Ice |
last post by:
HI,
Pls. see the following function declaration:
int foo(const char *);
How to get the return typename and parameter typenames from the declaration?
For example, I need some codes like the following pseudocode:
typedef typename ReturnType(&foo)::Type AType;
Regards,
|
by: Christian Engström |
last post by:
If you have a function that returns something by value, the gcc compiler
(version 3.2.3 on Windows XP with MinGW) converts the returned value
from the type you specify in the code, to the const version of that type.
Is this a bug that is specific to gcc, or is it a flaw in the language
specification that gcc diligently implements? For example, the below
program produces the output
Constant
Mutable
|
by: franco ziade |
last post by:
what does this declaration mean in C++
void func_name() const
{ ... }
is this a const function ?
what are the implications?
thanks
|
by: Sundar |
last post by:
Do we have something called a const function ? I thought applying the
'const' specifier to a function is meaningless... but when i tried
defining a const function it worked !!
like...
const int func(int a)
{
int b;
.....
return b;
}
|
by: franco ziade |
last post by:
what does this declaration mean?
void function_name() const
{}
This means that the function is constant? what is the implication?
Thanks
| |
by: INeedADip |
last post by:
What is the difference between:
function setupGrid( param ){......}
and
setupGrid = function( param ){......}
Are there any advantages to doing one over the other?
|
by: wtu |
last post by:
function Declaration&Definition
--------------------------------------------------------------------------------
" Geroty (const vector<Point3D>& poly, const Plane& Tr)"
As i'm c++ beginner the following Function Declaration and Definition couldnt understandable? so explain me what kind of Declaration this is."const vector<Point3D>& poly....." ? and where do I find study materials for the kind of function declaration"
Also pleas...
|
by: Lawrence Spector |
last post by:
Base base;
BaseWrap& baseWrap(reinterpret_cast<BaseWrap&>(base));
boost::python::object obj(boost::shared_ptr<BaseWrap>(&baseWrap)); //
Compile error
Results in this error:
1>PythonPassReference.obj : error LNK2019: unresolved external symbol
"class boost::python::api::object __cdecl obj(class
boost::shared_ptr<struct BaseWrap&)" (?obj@@YA?
|
by: Sri Harsha Dandibhotla |
last post by:
Hello all.
I recently came across a function declaration as :
char(*(*x()))();
This was not in some code but it was in a C questions thread on some
group.
I tried to decipher what it returns but couldn't make complete sense
out of it. Can someone please explain what this function is supposed
to return and expand it step by step.
Thanks,
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |