Why "using namespace std;" is Bad Practice in C++ | Namespace Pollution & 2 Better Ways
Dr. Code
0:00 / 0:00
Why "using namespace std;" is Bad Practice in C++ | Namespace Pollution & 2 Better Ways
54 просмотра · 9 дн. назад
Dr. Code
324 подписчика
54 просмотра · 9 дн. назад
Welcome to Lecture 09 of our complete Programming Fundamentals using C++ course in Urdu (1080p 60fps)! Almost every beginner C++ tutorial tells you to write "using namespace std;" at the top of every file—but in real-world software engineering, doing this in every program is discouraged and considered bad practice. Today, we uncover why!
In this lecture, we visually explain what the "std" namespace actually is and how objects like cout, cin, and endl live inside it. You will learn how "using namespace std;" pollutes your entire program scope, explore two clean, professional methods to solve this issue without polluting your namespace, and prove everything we learned with a live coding demonstration!
⏱️ Video Chapters / Timestamps:
00:00 Intro
00:17 Why "using namespace std;" is Discouraged (Why It's Not Optimal for Every Program)
02:18 What is "std"? How cout, cin & endl Live Inside std (Visually Explained)
03:40 Method #1 to Resolve Namespace Pollution in Your C++ Program
04:28 Method #2 to Resolve Namespace Pollution in Your C++ Program
05:35 Live Coding Proof: Testing Everything in Code & Seeing the Actual Result
💻 Source Code & Course Material (GitHub):
🔗 https://github.com/usman-academia/yt-...
📚 Complete Programming Fundamentals in C++ Playlist:
🔗 • How Computers Understand Code? | Levels of...
🔔 Subscribe to Dr. Code for high-quality Computer Science courses in Urdu (1080p 60fps):
🔗 / @code-dr
If this lecture changed the way you write C++ code, hit the LIKE button, share this video with your classmates, and tell me which method you prefer in the comments below!
#UsingNamespaceStd #CppBestPractices #StdNamespace #ProgrammingFundamentals #CppInUrdu #LearnCpp #DrCode