Hairan

Member
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

133 Neutral

About Hairan

  • Rank
    Newbie
  1. How do I run a .java written in notepad++

    Check out this guide on how to compile a .java file and run it in Windows using the command prompt: http://www.skylit.com/javamethods/faqs/javaindos.html
  2. Getting Started

    As others said C# is a quite easy language to get started with. And once you get a hold of one learning another will be much easier. I haven't read any books while learning C# so I can't recommend any. If you wanna learn C# I would recommend: [url="http://msdn.microsoft.com/en-us/vstudio/hh341490"]http://msdn.microsof...studio/hh341490[/url] it is up to date and there are very much content and in my opinion easy to follow.
  3. Oh god... Thank you so much. I was almost certain I tried that, but obviously not. Again thank you for your fast reply!
  4. Hey! So I have been trying to split my code into several files and using headers to declare the classes and then define them in a source file. The problem is in the Source file I can access all the public functions and define them nicely, but I am not able to use the private variables inside those functions. How can you solve this? I have tried reading the tutorial on GameDev.net, which was really nice, but still get this error. I get the following error: Quote: c:\users\johan\documents\visual studio 2008\projects\oop_test\oop_test\player.cpp(8) : error C2065: 'health' : undeclared identifier 1>c:\users\johan\documents\visual studio 2008\projects\oop_test\oop_test\player.cpp(14) : error C2065: 'health' : undeclared identifier My code is: Player.h Quote: #ifndef _PLAYER_H #define _PLAYER_H class Player { public: void set_health(int amount); // Public set function int get_health(); // Public get function private: int health; }; #endif Player.cpp Quote: #include "Player.h" // MY PLAYER CLASS // define our set function void set_health(int amount) { health = amount; } // define our get function int get_health() { return health; } main.cpp Quote: #include "Player.h" #include <iostream> using namespace std; /* Main function */ int main() { Player player1; cout << "MAIN FUNCTION" << endl; cout << "Creating class: Player" << endl; player1.set_health(10); cout << "Player health: " << player1.get_health(); int dummy; cin >> dummy; } I guess it is something really simple, tried googling and everything for hours without a good answer :P