Book a Demo

Author Topic: How to declare a const operation? (C++)  (Read 3117 times)

Hoff

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
How to declare a const operation? (C++)
« on: April 10, 2010, 12:49:29 am »
Hello,
I want to add a const function to a class.

What I am doing is:

-Right-click the class / Operations...
-Then I define my operation and mark the "Const" box.

But when I generate the code, it generates the funtion as:

Code: [Select]
const char Func();

Which means that it is a "non const" function with a "const" return.

What I want to do is a "const" function, like this:
Code: [Select]
char Func() const;


Is it a bug of EA, or does that "Const" checkbox related to the property of the return of the function, and not to the function's property?

If it is not a bug, so is it possible to define the function as a Const?

Thanks

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How to declare a const operation? (C++)
« Reply #1 on: April 12, 2010, 08:24:18 am »
You're after is query.

Hoff

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: How to declare a const operation? (C++)
« Reply #2 on: April 13, 2010, 12:07:03 am »
Thank you