[code]
#include < iostream.h >
void main()
{
Printable View
[code]
#include < iostream.h >
void main()
{
[ Using Directive ]
เป็นการประกาศใช้ identifier ทุกตัวใน namespace นั้นๆ โดยที่ไม่ต้องระบุชื่อ namespace เช่น
using namespace std; /* all identifiers in std namespace will be using without explicit qualifier */
using namespace BlueBlood /* all identifiers in BlueBlood namespace will be using without explicit qualifier */
[ Using Declaration ]
คล้ายกับ using directive แต่ต่างกันตรงที่ using declaration จะเจาะจง identifier เป็นตัวๆไป เช่น
using std::cout; /* identifier cout will be using without explicit qualifier */
using BlueBlood::myVar; /* identifier myVar will be using without explicit qualifier */
using namespace BlueBlood /* all identifiers in BlueBlood namespace will be using without explicit qualifier */
BlueBlood คือ identifiers หรืออะไรหรอคับ ไม่เข้าใจบรรทัดนี้
กำลังศึกษาอยู่พอดีครับ กำลังงง ว่า code แรก เป็น iostream.h อันหลัง ไม่มี .h
เพิ่มอีกนิดนึง ถ้าจะใช้คำสั่ง cout อย่างเดียวใช้ using std::cout; ก็ได้ครับ
ผิดพลาดยังไงติเตือนได้ครับ มือใหม่หัดเขียน :D