Solved

Constant objects

Posted on 1998-10-08
2
190 Views
Last Modified: 2010-04-02
Hi friends,
          Why is it not possible to invoke a nonconstant member function using a constant object?.Thanks a lot.
0
Comment
Question by:tmmet
2 Comments
 
LVL 1

Accepted Solution

by:
Booth882 earned 0 total points
ID: 1174699
because that is the whole idea behind constant objects, that you cant change anything in it.  functions that are not declared const are able to change the data in an object and therefore would defeat the whole purpose of declaring it const in the first place, so const objects are not allowed to call them.  it is one more instance of rigid c++ object oriented programming
0
 
LVL 22

Expert Comment

by:nietod
ID: 1174700
tmmet, these are beginning to sound a lot like homework questions.  We can ASSIST you on your homweork to some degree, but we cannot do it for you.   That is unethical and is cause for removal from EE (for both you and us).
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now