---
title: "How can specify a const member function?"  
description: "How can specify a const member function?"  
author: "Anonymous User"  
published: 2013-06-15  
updated: 2013-06-15  
canonical: https://www.mindstick.com/forum/1124/how-can-specify-a-const-member-function  
category: "visual c++"  
tags: ["visual c++"]  
reading_time: 1 minute  

---

# How can specify a const member function?

Hi [Expert](https://www.mindstick.com/articles/13120/an-expert-financial-advice-will-improve-your-finances),\
How can specify a [const](https://www.mindstick.com/forum/105419/what-is-the-difference-between-read-only-and-const-keyword) member [function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server)? \
Thanks.

## Replies

### Reply by AVADHESH PATEL

Hi,\
Try this:\
Class member functions can be declared as const.When this is done,that function cannot modify the object that invokes it.Also,a const object cannot invoke a non-const objects.However,a const member function can be called by either const or non-const objects.\
example:\
**class{****int some_var;****public:****unt f1() const;****};**


---

Original Source: https://www.mindstick.com/forum/1124/how-can-specify-a-const-member-function

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
