Re: Same import lines again and again
@9: that's true, however I was talking about hidden includes, not including one header more times.
if you write:
#include <iostream>
You get not just objects like cin, cout, but also string which comes from the string header included by the iostream header.
So after including iostream, you can go and use std::string in the file where you included it.
However because just from #include <iostream> it isn't obvious that string will get included as well, it's considered to be good practice for readability to include it explicitly like:
#include <iostream>
#include <string>
Despite it isn't needed for compiler as it will know already from iostream what string is.
Of course it could look overdramatising showing where string comes from, but in a more abstract environment it can help much demonstrating, where have class dependencies appeared from.
I had quite funny times studying Ruby. Although I was rather looking for peculiarities than doing a senseful learning, with Ruby's principle of connecting various methods directly to datatypes such as int from external sources, importance of tracking and writing imports gets a fully new dimension.
I just couldn't believe how universal an int in Ruby is.
Best regards
Rastislav
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector