Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++]Question

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
IMRobbie
Newbie cheater
Reputation: 0

Joined: 26 Sep 2009
Posts: 24

PostPosted: Fri Dec 04, 2009 3:13 pm    Post subject: [C++]Question Reply with quote

Can someone write me some sample code that would place a blank space between each character in a string?
Or just explain?
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Fri Dec 04, 2009 4:26 pm    Post subject: Reply with quote

Code:
#include <iostream>
#include <string>

using namespace std;

int main()
{
   string something = "WhatisthisIdon'teven...";

   for(string::iterator i = something.begin() + 1; i != something.end(); i = something.insert(i, ' ') + 2);

   cout << something << endl;

   return 0;
}
Back to top
View user's profile Send private message
marryjohnson
How do I cheat?
Reputation: 0

Joined: 11 Dec 2009
Posts: 7

PostPosted: Wed Dec 16, 2009 12:07 am    Post subject: Reply with quote

What is the use of virtual destructor? Please any one explain this with example..
Thanks..

_________________
memory cards
Back to top
View user's profile Send private message Send e-mail
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Dec 16, 2009 12:51 am    Post subject: Reply with quote

a virtual function lets you override the functionality of whatever in the base class, using your derived class.

say you had a class and it's derived class. without a virtual deconstructor, the derived deconstrutor wouldn't be called.
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Wed Dec 16, 2009 1:02 am    Post subject: Reply with quote

You need it when dealing with polymorphism and dynamic memory allocation. You can see the effects in the following example: http://codepad.org/nMT5ph0s

You'll notice that the destructor in the first part is not called (shock! horror!). We can remedy this by making the destructor virtual (as shown in the second part).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites