Solved

Constant objects

Posted on 1998-10-08
2
197 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
object oriented programming on screen browser tutorial lesson 2 87
sorting efficency of sorting algorithm 30 134
Dialogbox API leak? 18 109
print bytes of an integer 6 27
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

730 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