I could not get this const before a function declaration

P

parag_paul

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
 
J

Jim Langston

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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top