OMGWTF CLASSES?!

Posts 1–10 of 10 · Page 1 of 1
OMGWTF CLASSES?!
Ok, so i've been reading alot lately, maybe too much, but I can always go back and re-read some things. Latest topic, Classes. This is my basic understanding of classes. Please tell me if i'm right or wrong.

I'll use cin as my example, i.e. cin.get(), cin.ignore(), etc.

cin is a structure , inside of the class Iostream. It's a structure, in the sense that there's multiple instances of cin (see above for reference to this.) So, iostream is the class, cin is a structure inside of it which contains all of the console input functions you need.

Since we use cin, it's function prototypes would be in the public section of the Iostream class, where it's actual implementation would be somewhere in the cin structure. Say we are implementing cin.ignore, in the iostream header it would look like this, right?

[PHP]iostream.cin::ignore[/PHP]

then a definition of what cin.ignore is. Correct?
Errr... wow.

I never took the time to pay that much attention to it. I'm not completely sure how it works, but I thought cin was an object of class iostream, and .ignore() and .etc were just functions of iostream, but idk I could be wrong. I would have to check.
Quote Originally Posted by why06 View Post
Errr... wow.

I never took the time to pay that much attention to it. I'm not completely sure how it works, but I thought cin was an object of class iostream, and .ignore() and .etc were just functions of iostream, but idk I could be wrong. I would have to check.
Well that's partially my question. Because I know that Iostream is obviously the class, but what would cin.ignore be defined as? The most logical way I could see it working is that cin is a structure inside of iostream. Does anyone know if a structure can be an object?

I'm not really wanting to get indepth about iostream, or cin, or any thing for that matter, I just want to make sure my understanding of Classes is right. I read about the constructor, destructors, yatta yatta, etc etc.
cin is an object of std o.O just checked
ignore(function) in c++ is defined under iostream::ignore AND istream::ignore
Quote Originally Posted by falzarex View Post
in c++ is defined under iostream::ignore AND istream::ignore
Iostream being the mother file, that would be an example of istream INHERITING cin.ignore() would it not?


EDIT! I have no clue what STD is at all, I just know I need using namespace std;

I hazn't cuvrd namespaces yetz.
Quote Originally Posted by ilovecookies View Post
Iostream being the mother file, that would be an example of istream INHERITING cin.ignore() would it not?


EDIT! I have no clue what STD is at all, I just know I need using namespace std;

I hazn't cuvrd namespaces yetz.
Most likely cin is just an object of type istream predefined in the <iostream> header file, it's not that big a deal.

It is possible that i stream could inherit from iostream, but I don't think it's likely. They might just be different classes. Damit enough speculation ;O
here:


Google is your friend. IOstream Library - C++ Reference
Quote Originally Posted by why06 View Post
Most likely cin is just an object of type istream predefined in the <iostream> header file, it's not that big a deal.

It is possible that i stream could inherit from iostream, but I don't think it's likely. They might just be different classes. Damit enough speculation ;O
here:

Google is your friend. IOstream Library - C++ Reference
That'll do Why, that'll do. Me and David were talking on Live and he filled me in on what I wanted to know. If I understood Classes or not. xD But yeah, he explain istream and ostream are classes inside of the IOstream Library.
Quote Originally Posted by ilovecookies View Post
EDIT! I have no clue what STD is at all, I just know I need using namespace std;
You should pay attention in school.
STD stands for Sexually Transmitted Disease

Quote Originally Posted by wikipedia
A sexually transmitted disease (STD), also known as sexually transmitted infection (STI) or venereal disease (VD), is an illness that has a significant probability of transmission between humans or animals by means of human sexual behavior, including vaginal intercourse, oral sex, and anal sex. While in the past, these illnesses have mostly been referred to as STDs or VD, in recent years the term sexually transmitted infection (STI) has been preferred, as it has a broader range of meaning; a person may be infected, and may potentially infect others, without showing signs of disease. Some STIs can also be transmitted via the use of IV drug needles after its use by an infected person, as well as through childbirth or breastfeeding. Sexually transmitted infections have been well known for hundreds of years.
Sexually transmitted disease - Wikipedia, the free encyclopedia
den u will becomez a ZOMBIEX
Posts 1–10 of 10 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us