Quick C++ Help

nife4

Senior member
Nov 24, 2003
375
0
0
I haven't been paying attention in class and now I'm taking a test and it's coming back to haunt me...

can someone help...

The question:

Briefly comment on the following statement: The main reason for using the private access specifier in a class is to "hide the data" from the user who is using the respective objects.

Someone Please Help!
 

KEV1N

Platinum Member
Jan 15, 2000
2,932
1
0
It's been about 4 or 5 years since I've been in a C++ class, but isn't private specifier to hide data from other objects and methods?
 

acemcmac

Lifer
Mar 31, 2003
13,712
1
0
Originally posted by: KEV1N
It's been about 4 or 5 years since I've been in a C++ class, but isn't private specifier to hide data from other objects and methods?

correct
 

KEV1N

Platinum Member
Jan 15, 2000
2,932
1
0
Oh yeah, or just Google it. Maybe the presidents of Google will sign your degree :)
 

Amplifier

Banned
Dec 25, 2004
3,143
0
0
Originally posted by: TheLonelyPhoenix
Originally posted by: Amplifier
The answer is cout >> "You're fvcked";

Its "<<", dumbass.

Edit: And, to the OP, do your own fvcking work.

I haven't touched C++ since highschool. But thank you for correcting me, 20 years from now when I use the language again I won't make that mistake :).
 

DaFinn

Diamond Member
Jan 24, 2002
4,725
0
0
Originally posted by: dighn
hide the date? is that at ypo?

No, he's asking for a best way to hide his date. He wants to use his "private specifier" with her...
 

nife4

Senior member
Nov 24, 2003
375
0
0
Originally posted by: TheLonelyPhoenix
Originally posted by: Amplifier
The answer is cout >> "You're fvcked";

Its "<<".

Edit: And, to the OP, do your own fvcking work.

And i'd do my own work if i understood this sh!t... my professor last semester sucked and now the new professor doesn't explain sh!t because he thinks our other professor actually taught us something
 

HumblePie

Lifer
Oct 30, 2000
14,665
440
126
private is to allow only the class the variable/attribute it belongs or is instantiated in to be accessed only by that class. It's mainly to prevent the corruption of data contained in that variable/attribute by randomly changes. This was an issue with pointers in C. Hence, getters and setters. If you need to change or retrieve data from a class, you use getters and setters.
 

TheLonelyPhoenix

Diamond Member
Feb 15, 2004
5,594
1
0
Originally posted by: nife4
Originally posted by: TheLonelyPhoenix
Originally posted by: Amplifier
The answer is cout >> "You're fvcked";

Its "<<".

Edit: And, to the OP, do your own fvcking work.

And i'd do my own work if i understood this sh!t... my professor last semester sucked and now the new professor doesn't explain sh!t because he thinks our other professor actually taught us something

Oh, I see... you don't like your professor, therefore its an excuse for you to jump on a forum and try to get people to take your test for you. :disgust:

I hope you fail.
 

nife4

Senior member
Nov 24, 2003
375
0
0
Originally posted by: TheLonelyPhoenix
Originally posted by: nife4
Originally posted by: TheLonelyPhoenix
Originally posted by: Amplifier
The answer is cout >> "You're fvcked";

Its "<<".

Edit: And, to the OP, do your own fvcking work.

And i'd do my own work if i understood this sh!t... my professor last semester sucked and now the new professor doesn't explain sh!t because he thinks our other professor actually taught us something

Oh, I see... you don't like your professor, therefore its an excuse for you to jump on a forum and try to get people to take your test for you. :disgust:

I hope you fail.

Ok? I didn't say I didn't like my professor........ I said that the professor I had last year didn't teach anything so now it is biting most of my class in the a**
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
It's too bad your book was glued shut, or you could have learned something from opening it.

If this is how motivated you are to learn, perhaps you should switch to a business degree.
 

Ranger X

Lifer
Mar 18, 2000
11,218
1
0
If you can't answer this question, you truly are fvcked!

cout << "End yourself!" << endl;
 

nife4

Senior member
Nov 24, 2003
375
0
0
Originally posted by: DaveSimmons
It's too bad your book was glued shut, or you could have learned something from opening it.

If this is how motivated you are to learn, perhaps you should switch to a business degree.

http://shop.osborne.com/cgi-bin/osborne/0072232153.html


this book doesn't really teach anything about classes and structures... but yeah i got a general understanding of what was supposed to be taught to me last here by reading it.
 

Platypus

Lifer
Apr 26, 2001
31,046
321
136
If your professor sucked then why haven't you set up a meeting with the new one in his office hours?
Why haven't you asked your fellow classmates who have an idea what is going on?
Why don't you use google and research C++, I found like 15 hits in 3 seconds
Why don't you read the book and figure it out?

This is the downfall of computers, lazy people who take classes and expect sh!t handed to them, you're the kind of prick I get stuck with in group classes who can't even read the fvcking directions and help us out.

Hopefully your poor grade on this test is a lesson to wise the fvck up and show some initiative, no one is going to hold your hand anymore.
 

purbeast0

No Lifer
Sep 13, 2001
53,765
6,646
126
Originally posted by: nife4
Originally posted by: DaveSimmons
It's too bad your book was glued shut, or you could have learned something from opening it.

If this is how motivated you are to learn, perhaps you should switch to a business degree.

http://shop.osborne.com/cgi-bin/osborne/0072232153.html


this book doesn't really teach anything about classes and structures... but yeah i got a general understanding of what was supposed to be taught to me last here by reading it.

Yea, but if you click on the "Sample Code" link on the right in that link, and look at the code, it gives you sample code that has class examples ... :roll:

you are a lazy fvcktard and i hope you learn your lesson the hard way by getting shltty grades on your test. thats what it took me to learn not to screw around in college.
 

newbiepcuser

Diamond Member
Jan 1, 2001
4,474
0
0
Originally posted by: HumblePie
private is to allow only the class the variable/attribute it belongs or is instantiated in to be accessed only by that class. It's mainly to prevent the corruption of data contained in that variable/attribute by randomly changes. This was an issue with pointers in C. Hence, getters and setters. If you need to change or retrieve data from a class, you use getters and setters.

If you understand this statement, then you can from here. Do you understand the concept of global? Do a search on google public vs private, it should help you get a run down on the importance of prevention of data corruption.

Whats done is done, you slack off. I've done it too and I took "hold my hand" professors etc and it I paid for it. I would say most CS professors sucks monkey balls and expect you do most of the work on your own. If you continue with CS, then you should expect to put more time into it.

There are also plenty of C++ forums with FAQs also on the net. They won't hold your hand either but there is some good reading.

 

ngvepforever2

Golden Member
Oct 19, 2003
1,269
0
0
Originally posted by: nife4
I haven't been paying attention in class and now I'm taking a test and it's coming back to haunt me...

can someone help...

The question:

Briefly comment on the following statement: The main reason for using the private access specifier in a class is to "hide the data" from the user who is using the respective objects.

Someone Please Help!


Private Classes are one of the first things that one learns in a programming class like C++. You are cheating on your test and I don't believe you are cut out for a computer science or engineering degree if you are asking such a simple question... and do your fvcking test on your own.