|
-
Feb 27th, 2001, 09:09 PM
#1
Thread Starter
Hyperactive Member
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
Amon Ra
The Power of Learning.
-
Feb 27th, 2001, 10:21 PM
#2
-
Feb 27th, 2001, 10:27 PM
#3
Thread Starter
Hyperactive Member
Ok
Ok thanx. BTW i am practicing classes, but what is a constructor??
Amon Ra
The Power of Learning.
-
Feb 27th, 2001, 11:00 PM
#4
Thread Starter
Hyperactive Member
Nevermind
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
The Power of Learning.
-
Feb 28th, 2001, 12:44 AM
#5
Thread Starter
Hyperactive Member
Problem
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
Amon Ra
The Power of Learning.
-
Feb 28th, 2001, 05:21 AM
#6
Frenzied Member
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!
-
Feb 28th, 2001, 12:08 PM
#7
Hyperactive Member
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++
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|