Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


codder88

Member Since 20 Aug 2010
Offline Last Active Aug 28 2013 05:27 AM

Posts I've Made

In Topic: c++ class help

10 November 2010 - 10:23 AM

ok... thank's guys :D

In Topic: c++ class help

10 November 2010 - 10:06 AM


#pragma once

#include "main.h"

class CClass2;

class CClass1
{
public:
CClass1(const CClass2 &Class2) { this->SetVar(Class2.GetVar()); }

void SetVar(int val) { var=val; }
int GetVar() const { return var; }

private:
int var;
};

class CClass2
{
public:
CClass2(const CClass1 &Class1) { var = 5; }

int GetVar() const { return var; }

private:
int var;
};



i'm using visual c++ 2010 express and the compiler give me error C2027 and C2228

In Topic: c++ class help

10 November 2010 - 08:26 AM

Quote:
Original post by _fastcall
Use a forward declaration for B or move the definition for class B above class A. See also: Organizing Code Files in C and C++.


in fact i want to use the class1 in class2 and class2 in class1

In Topic: c++ class help

10 November 2010 - 08:24 AM

if i add "class class2;" at the top of the file the compiler give me again the errors

In Topic: CVar system (like quake3 console)

19 October 2010 - 05:48 AM

Quote:
Original post by Aardvajk
For variables, std::map<std::string,std::string> and convert the values to ints, floats whatever when you need the values.

Functions is a bit more tricky. Most conventional scripting languages I am aware of have a standard signature, e.g.:

class script_params { /* ... */ };

typedef int(*script_func)(script_params&);

And it is the responsibility of the native code to decode parameters from the supplied information.

Best way I guess would be to look at how something like Lua (or the more recent and pretty interesting IonScript I spotted on here the other day) handles it. That should give some inspiration.


Thanks :)

PARTNERS