PDA

Click to See Complete Forum and Search --> : Console Programming


Amon Ra
Feb 27th, 2001, 08:09 PM
Hey guys, i have followed ur advices, and done quite a bit of console programming. Now, when do i know if i can start Windows programming? Cuz the tuts i found dont go very far, and so i dont know what is required to go into windows programming. Please answer, i really want to get into this :)
Thanx for givin' a helpful answer :)

Forger
Feb 27th, 2001, 09:21 PM
I think you should learn up to classes before you start looking at windows programming. I just started windows programming and found it isn't nearly as easy as console programming. It looks like it will take forever to memorize, so I recommend taking parksies example and just learn enough to modify it. So, as long as you have a good basic understanding of the basic functions of console programming you could start windows programming :D

Amon Ra
Feb 27th, 2001, 09:27 PM
Ok thanx. BTW i am practicing classes, but what is a constructor??

Amon Ra
Feb 27th, 2001, 10:00 PM
I found out that a constructor in a class was to initialize the class. Now i know how to define a function outside of the class:

class Computer //Standard way of defining the class
{
public:
//This means that all of the functions below this(and any variables)
//are accessible to the rest of the program.
//NOTE: That is a colon, NOT a semicolon...
Computer();
//Constructor
~Computer();
//Destructor
void setspeed(int p);
int readspeed();
//These functions will be defined outside of the class
protected:
//This means that all the variables under this, until a new type of
//restriction is placed, will only be accessible to other functions in the
//class. NOTE: That is a colon, NOT a semicolon...
int processorspeed;
};
//Do Not forget the trailing semi-colon
Computer::Computer()
{ //Constructors can accept arguments, but this one does not
processorspeed = 0;
//Initializes it to zero
}

Computer::~Computer()
{ //Destructors do not accept arguments
}
//The destructor does not need to do anything.

void Computer::setspeed(int p)
{ //To define a function outside put the name of the function
//after the return type and then two colons, and then the name
//of the function.
processorspeed = p;
}

but is there a way to define a function inside the class?
thanx for answering :)

Amon Ra
Feb 27th, 2001, 11:44 PM
I think i got lost in practicing classes. Does any of you know a good place to learn how to write classes, or even better, could any of you explain to me how? Thanx!
If you are nice enough to explaint to me, then in the explanation, could u tell me all the basics, but also the main concepts and a few tips? Thanks a lot

CyberCarsten
Feb 28th, 2001, 04:21 AM
I'm also new to C++, and I just recently started console programming by reading a billion of beginners tutorials!!(They paid of) Yesterday I got the book Windows Game Programming for Dummies, which shows you how make your own games in C++ with DirectX. The best though, is that, is use 5 or 6 chapters learning you to make windows applications. I would recommend this book! :)

MrShickadance
Feb 28th, 2001, 11:08 AM
Amon Ra I think you are a little confused... lemme try to explain :)

[CODE]

// basic form for a class

class MyClass
{
public:
// constructors (intializing the classes)
MyClass(....);

// destructors
~MyClass();

// define public functions that others can use to access private data in your class

protected:
// define "non visible" functions and data that can only be seen by this class and classes that inherit from this class.

private:
// define "non visible" functions and data that can only be seen by the this class

};

[CODE]

I would recommend buying the book "C++ from the Ground Up" it is an excellent book and covers almost all the topics in C++