Originally posted by GreatEmerald
View Post
cout is actually an object and you just call operator "<<" on it. cout is not a keyword, it's just name for a struct that someone made and the "<<" operator was just simply chosen because it looks nicer than (+,-,*...). You don't have to use the STL library. It's absolutely not mandatory or recommended. (Embedded systems don't use STL, Qt doesn't use STL...)
Anyway, these operator overloading is a beautiful thing. You can do something like complexnum3 = complexnum1 + complexnum2 and you can define what + and = do. It's like automatic calling some function complexsum(c,a,b) without any overhead over ordinary function. The cout << is just like that. You can you use printf. You can write somehting new. You can even use inline assembly like in C.
Comment