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 


Help w/ Classes C++

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
GMZorita
Grandmaster Cheater Supreme
Reputation: 0

Joined: 21 Mar 2007
Posts: 1361

PostPosted: Tue Oct 07, 2008 12:47 pm    Post subject: Help w/ Classes C++ Reply with quote

Hmm if i had my code.

alala.h
Code:

#include <classes.h>

class Caa
{
      void ods();
}

class Cmaster
{
      Caa* aa;
}
extern Cmaster* master;


alala.cpp
Code:

#include <windows.h>
Caa* aa;

Caa::ods()
{
OutputDebugString("Hello");
}


main.cpp
Code:

#include "alala.h"

int main()
{
master->aa->ods();
}


It gives me an error and the function won't be executed.
Anyone know how I'm supose to do it?

_________________
Gone
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Tue Oct 07, 2008 1:01 pm    Post subject: Reply with quote

Wtf is going on here?..
Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Oct 07, 2008 1:06 pm    Post subject: Reply with quote

Take another look at what you're doing with that pointer to the class.
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Tue Oct 07, 2008 3:19 pm    Post subject: Reply with quote

noz3001 wrote:
Wtf is going on here?..
I agree.

If you want to do it that way (which I don't recommend):
Code:
#include <iostream>

class Caa
{
public:
   void ods() { std::cout << "Hello World"; }
};

class Cmaster
{
public:
   Caa *aa;
};

int main(int argc, char *argv[])
{
   Cmaster *master = new Cmaster();
   master->aa = new Caa();
   master->aa->ods();

   delete master->aa;
   delete master;

   return EXIT_SUCCESS;
}
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