473,698 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

call non-const function

GFXMLTree* Seek4Node(LPCTS TR name);
const GFXMLTree* Seek4Node(LPCTS TR name) const
{
return Seek4Node(name) ; // Force to call the first version
}
--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%c gl%ssic%ccom%c" , "ma", 58, 'g', 64, "ba", 46, 10);}
Jul 23 '05 #1
1 1569
Gernot Frisch wrote:
GFXMLTree* Seek4Node(LPCTS TR name);
const GFXMLTree* Seek4Node(LPCTS TR name) const
{
return Seek4Node(name) ; // Force to call the first version
}


You can only safely do that if you know that your object was in fact
non-const when it was created. But that's only known by the caller,
not inside the function. So, before calling the overloaded member
function, cast the constness away.

V
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1224
by: MPOOL'03 Organizers | last post by:
We apologize if you receive this CfP multiple times * Please distribute ! -------------------------------------------------------------------------- CALL FOR PAPERS Workshop on MULTIPARADIGM PROGRAMMING WITH OO LANGUAGES (MPOOL'03) at the Conference on
0
1260
by: MPOOL'03 Organizers | last post by:
We apologize if you receive this CfP multiple times * Please distribute ! -------------------------------------------------------------------------- CALL FOR PAPERS Workshop on MULTIPARADIGM PROGRAMMING WITH OO LANGUAGES (MPOOL'03) at the Conference on
13
1574
by: Mike Qin | last post by:
Hi there, Now I'm writing code mainly in C++. And some existing c code will call some functions which are in a C++ class. I read the basic techniques introduced from a SUN's web site. Basically 1. we can add extern "C" keyword, or 2. use the object in C++ code as struct in C.
0
1447
by: Jörg Striegnitz | last post by:
We apologize if you have received this CfP multiple times. -------------------------------------------------------------------- SECOND CALL FOR CONTRIBUTIONS AND PARTICIPATION Workshop on MULTIPARADIGM PROGRAMMING WITH OO LANGUAGES (MPOOL 2004) (June 14 or 15, TBD) at the EUROPEAN CONFERENCE ON OBJECT-ORIENTED PROGRAMMING (ECOOP 2004)
8
3849
by: ThomasR | last post by:
I understand that virtual methods on inherited objects are slower than non-virtual methods because of the indirection required to support the call. However, when looking at IL code produced by the compiler, I notice that all methods on object variables use callvirt instead of call, regardless of whether the method is truly virtual or not. I assume this allows .NET to check if the object reference is null or not before invoking the...
5
2812
by: Ross | last post by:
Hi, I have the following program: #include <stdarg.h> class A { public: A() { } }
46
3840
by: Steven T. Hatton | last post by:
I just read §2.11.3 of D&E, and I have to say, I'm quite puzzled by what it says. http://java.sun.com/docs/books/tutorial/essential/concurrency/syncrgb.html <shrug> -- NOUN:1. Money or property bequeathed to another by will. 2. Something handed down from an ancestor or a predecessor or from the past: a legacy of religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF, from ML legatia, from L legare, to depute, bequeath....
1
2308
by: Ken Williams | last post by:
Assume I have two Forms Form1.cs and Form2.cs. When a button but1-switch is clicked on Form1.ca the second Form2.cs should be called and displayed. How do I call the second Form2.cs in modal style ? How would the same call look like if I call the second Form in non-modal style ? Ken
3
2401
by: Kevin Walzer | last post by:
I'm currently using os.popen in an application of mine, which calls for non-blocking data, in this fashion: self.file = os.popen('echo %s | sudo -S /sw/bin/fink -y install %s' % (self.passtext, self.packagename), 'r', os.O_NONBLOCK) What is the equivalent/comparable call in the new subprocess module? I can't find any reference in the Python docs to non-blocking streams. --
12
29880
by: puzzlecracker | last post by:
is it even possible or/and there is a better alternative to accept input in a nonblocking manner?
0
8674
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9026
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8893
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7723
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4366
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.