Newbie C++! Please Help!

Started by
17 comments, last by HOTSHOT 21 years, 9 months ago
Did you learn C++?

We C++-Programmers, don''t use puts,scanf,printf!
Why dont you learn more bout iostream.h?
Advertisement
quote:Original post by Zeraan
Private members cannot be accessed outside the class, you have to access them via functions that is public.

______________________________________________
You know your game is in trouble when your AI says, in a calm, soothing voice, "I''m afraid I can''t let you do that, Dave"




tell him about my
friend 


Metal Typhoon

Metal Typhoon
"Did you learn C++?

We C++-Programmers, don''t use puts,scanf,printf!
Why dont you learn more bout iostream.h?"

we C++ programmers don''t use iostream.h either!
Why don''t you learn more bout iostream?
Hiya all

quote:
"Did you learn C++?

We C++-Programmers, don''t use puts,scanf,printf!
Why dont you learn more bout iostream.h?"

we C++ programmers don''t use iostream.h either!
Why don''t you learn more bout iostream?


Alright alright.......but I still learning on C++....u cantjust stick a knife at me cos I doing wrong......I''m learning for first C++...as I''m newbie c++.....just give me break....I will get there in the end...
I put # include < iostream.h > or iostream.h between in < >

I not trying to be nasty but I just trying my best here as I''M very greatful to see nice people helping me but what i dont like is....People who nasty to me....putting a big stick at me as newbie c++...as I could understand if I was very good at c++ and people say that is not c++ cos of puts,sanf, printf!

I''m easy going guys who what to say or not to say...I''m deaf person myself....as people got to understand what I say as my english is not bad but there u ago....

Thank for reading this....and also...I like to thank to all those people who help me ...I''m glad that I have found this site cos I did like to learn all those windows programs like rollercoaster tyoons game which is cool GUI!

Cheer all

HOTSHOT
I''m not real familiar with friend command. I think it allows a class to access another class'' private members? Not sure about this.

______________________________________________
You know your game is in trouble when your AI says, in a calm, soothing voice, "I''m afraid I can''t let you do that, Dave"
quote:Original post by Zeraan
I''m not real familiar with friend command. I think it allows a class to access another class'' private members? Not sure about this.


You''re right. You can also use it to allow individual functions access the class'' protected and private members.

/*=========================================*/
/* Chem0sh */
/* Lead Software Engineer & Tech Support */
/* http://www.eFaces.biz */
/*=========================================*/
/*=========================================// Chem0sh// Lead Software Engineer & Tech Support// http://www.eFaces.biz=========================================*/
hiya all


Let get this straight.....here the basic and c++


Basic c++

Global Public

Local Private


is this is right?

In programming basic.....global mean they can access all the function like public in c++ but for Local mean they only access some function and that will be private....

Can anyone clear up the questions I ask please as I do know lots about basic but I did like to know those c++ like publice and private!

Sorry about that!

HOTSHOT
Um... msgbox "123!"
=D
ok, to explain it a little more clearly, I''ll show you an example.

class SomeClass
{
public:
void someFunction();
void someAccesser();

int someData;

private:
int someAnotherData;
} SomeClassA;

to access your public members, you do this:

SomeClassA.someFunction();
SomeClassA.someAccesser(); //this does something with someAnotherData;

SomeClassA.someData = 6; //you can do this because its public, can be accessed outside of class

However, you CAN''T do this:

SomeClassA.someAnotherData = 7;

because it''s private and you will get compiler error. This helps you in organizing your code and make less bugs. To manipulate your private data, you need public functions like this:

void SomeClass::someAccesser()
{
someAnotherData++;
}

If you understand this, then you pretty much know one of the main features of C/C++.

______________________________________________
You know your game is in trouble when your AI says, in a calm, soothing voice, "I''m afraid I can''t let you do that, Dave"

This topic is closed to new replies.

Advertisement