Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 15:54

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Read only function

Discussion on Read only function within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Oct 2014
Posts: 25
Received Thanks: 10
Read only function

Was ist genau der Sinn von read only Funktionen?
(ich weiß, was das ist und was es bewirkt)
Aber warum soll man read only Funktionen nutzen?
Man kann doch einfach mit normalen Funktionen Werte wiedergeben ohne andere Werte zu verändern.

MfG
cMz' is offline  
Old 10/16/2014, 16:06   #2

 
Delinquenz's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,160
Received Thanks: 232
Sind hiermit konstante Memberfunktionen gemeint?
Delinquenz is offline  
Old 10/16/2014, 16:07   #3
 
elite*gold: 0
Join Date: Oct 2014
Posts: 25
Received Thanks: 10
Ja
cMz' is offline  
Old 10/16/2014, 16:13   #4
 
Padmak's Avatar
 
elite*gold: 58
Join Date: Jun 2008
Posts: 2,311
Received Thanks: 8,420
Wenn du ein const-Objekt hast, müssen alle validen Funktionen mit const gekennzeichnet werden - geht sonst nicht.

Beispiel:
Code:
class A{
public:
    int getValueA(){ return 0; }
    int getValueB() const { return 0; }
};

...

const A* a = new A;
a->getValueA(); // <- GEHT NICHT
a->getValueB(); // <- Geht
Padmak
Padmak is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
Running Function 2 after Function 1 finished
09/15/2013 - AutoIt - 3 Replies
Hey, its me again. Im stuck on a problem since yesterday and as much as i hate to ask for help, i really dont know what else to try. I want Function 2 to run after Function 1 has finished. I tried GuiCtrlSetOnEvent and MsgLoop, but i dont really understand it. I tried to read tutorials but they didnt help at all. The line that are underline is what im talking about. I want gamestart() to run first and when its finished, i want iniviteteam() to run. #AutoIt3Wrapper_UseX64=n...
socket_read() [function.socket-read]: unable to read from socket [0] - Problem
03/10/2012 - Web Development - 0 Replies
Thema gelöst ; )



All times are GMT +2. The time now is 15:54.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.