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

No members online now.

Forum statistics

Threads
473,955
Messages
2,570,117
Members
46,705
Latest member
v_darius

Latest Threads

Top