The Difference Between Plain Enum And Enum Class In C++?

  Рет қаралды 32,415

CppNuts

CppNuts

Күн бұрын

JOIN ME
-----
KZbin 🎬 / @cppnuts
Patreon 🚀 / cppnuts
COMPLETE PLAYLIST
------------
C++ Tutorial For Beginners: • Introduction To C++
STL (Standard Template Library): • STL In C++
ThreadIng In C++: • Multithreading In C++
Data Structures: • Data Structure
Algorithms: • Binary Search
Design Patterns: • Factory Design Pattern...
Smart Pointers: • Smart Pointer In C++
C++14: • Digit Separator In C++
C++17: • std string_view in C++...
C++ All Type Casts: • static_cast In C++
INTERVIEW PLAYLIST
------------
C++ Interview Q&A: • Structural Padding & P...
C++ Interview Q&A For Experienced: • How delete[] Knows How...
Linked List Interview Questions: • Find Kth Node From Bac...
BST Interview Questions: • Search Element In Bina...
Array Interview Questions: • Reverse An Array
String Interview Questions: • Check String Is Palind...
Bit Manipulation Questions: • Find Set Bit In Intege...
Binary Tree Interview Question: • Invert Binary Tree
Sorting Algorithms: • Bubble Sort
C++ MCQ: • Video
C MCQ: • What printf returns af...
C Interview Questions: • Designated Initializat...
QUICK SHORT VIDEOS
-------------
C++ Short : • C++ Short Videos
C Short : • Shorts C Programming MCQ
In this video we'll learn about The Difference Between Plain Enum And Enum Class In C++ and it becomes very handy and type strict. It would not implicitly cast-ed to integer type.
#cpp #interviewquestions #programming #tutorial #coaching #beginners #computerscience #softwareengineering

Пікірлер: 43
@jeribertopower7611
@jeribertopower7611 3 жыл бұрын
An explanation online felt confusing but now is crystal clear. Thanks!
@CppNuts
@CppNuts 3 жыл бұрын
Great to hear!
@SkSafowan
@SkSafowan 4 ай бұрын
Simple to the point Excellent tutorial my friend
@mastermax7777
@mastermax7777 Жыл бұрын
excellent tutorial. provides very good reasons to always use enum classes instead of regular enums
@tincustefanlucian7495
@tincustefanlucian7495 7 жыл бұрын
Thanks, I just learned something new
@dishantkumawat7508
@dishantkumawat7508 3 жыл бұрын
Very clear explanation Thanks
@CppNuts
@CppNuts 3 жыл бұрын
Glad it was helpful!
@Byynx
@Byynx Ай бұрын
Cppnuts always making the difference.
@spicytuna08
@spicytuna08 6 жыл бұрын
valid point. this video just answered a remark i have made in the previous video.
@kutalpdilber8815
@kutalpdilber8815 3 жыл бұрын
exactly what i wanted to know, elaborately explained, thanks.
@CppNuts
@CppNuts 3 жыл бұрын
Glad it was helpful!
@RachitGarg900
@RachitGarg900 3 жыл бұрын
Very good explanation.
@CppNuts
@CppNuts 3 жыл бұрын
Glad it was helpful!
@tchovosky
@tchovosky 2 жыл бұрын
Great video!
@batoolazzam6422
@batoolazzam6422 2 жыл бұрын
thanks for this video I have an exam on this tomorrow and my professor never explained it in depth
@AakashKumar-gl2fk
@AakashKumar-gl2fk 5 жыл бұрын
So much knowledge in a single video
@CppNuts
@CppNuts 5 жыл бұрын
Thanks man!!
@angelopapaya4692
@angelopapaya4692 Жыл бұрын
How to use cin, enum classes and switch cases? I would like to that integer which i put from keyboard to be something from enum
@spicytuna08
@spicytuna08 6 жыл бұрын
thanks for clarifying this important point.
@CppNuts
@CppNuts 6 жыл бұрын
You are welcome!!
@apurvkumar1808
@apurvkumar1808 4 жыл бұрын
since enum classes are full fledged classes we should be able to overload the operators for them ???
@LuvableRawrRawr
@LuvableRawrRawr 3 жыл бұрын
This is the best explanation ty!
@CppNuts
@CppNuts 3 жыл бұрын
Glad it was helpful!
@brazo98
@brazo98 5 жыл бұрын
Thx a lot you explain this very magic like thinking simple SJ! 🖖🏻🖖🏻🖖🏻
@CppNuts
@CppNuts 5 жыл бұрын
Thanks alot, it motivates.
@madhurimaburagohain7438
@madhurimaburagohain7438 4 жыл бұрын
Thank you for explaining so well. Please make videos on boost library.
@CppNuts
@CppNuts 4 жыл бұрын
Thanks man i may try..
@nssravitejalakkoju3909
@nssravitejalakkoju3909 6 жыл бұрын
can we compare a string and a variable in enum class or enum
@MrKreidel
@MrKreidel 6 жыл бұрын
Another important advantage of enum classes is that you can specify its size: enum class Colors : char { red, green, blue} That is really handy for memory limited environments such as embedded systems.
@manuelmueller7243
@manuelmueller7243 4 жыл бұрын
you can do the same for regular enums
@MrKreidel
@MrKreidel 4 жыл бұрын
@@manuelmueller7243 how so? Are you referring to compiler features? Professionally I would never go for such lock-in.
@treyquattro
@treyquattro 4 жыл бұрын
@@MrKreidel it's in the spec
@MrKreidel
@MrKreidel 4 жыл бұрын
@@treyquattro Can you point me to where the spec defines that? I still think it doesnt. Also, I don't see how I could syntactically formulate this in code.
@treyquattro
@treyquattro 4 жыл бұрын
@@MrKreidel dude. en.cppreference.com/w/cpp/language/enum
@kudoamv
@kudoamv 7 жыл бұрын
I don't know why but in MSVC even after putting int green = 100; it still compiled . Maybe it's a runtime error ? Sir can you please help ?
@CppNuts
@CppNuts 7 жыл бұрын
Shinichi Kudo it should not compile please check your green spelling or you might have done something else.
@Gundyr54
@Gundyr54 Ай бұрын
thank youuuuuuuuuuuuu
@haos4574
@haos4574 6 жыл бұрын
wow, didn't know that
@sebby5336
@sebby5336 Ай бұрын
This was amazing. wth
@treyquattro
@treyquattro 4 жыл бұрын
People {good, bad} should be a fundamental type!
Big Endian And Little Endian
8:56
CppNuts
Рет қаралды 43 М.
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.
C++ Tutorial:  enumerated data types [enums]
16:38
Professor Hank Stalica
Рет қаралды 2,6 М.
Cursed C++ Casts
17:41
Logan Smith
Рет қаралды 80 М.
Difference Between Reference And Pointers In C++
10:02
CppNuts
Рет қаралды 65 М.
ENUMS in C++
7:45
The Cherno
Рет қаралды 403 М.
When do I use a union in C or C++, instead of a struct?
11:18
Jacob Sorber
Рет қаралды 72 М.
you will never ask about pointers again after watching this video
8:03
reinterpret_cast In C++
14:33
CppNuts
Рет қаралды 45 М.
C++ Weekly - Ep 232 - C++20's `using enum`
7:04
C++ Weekly With Jason Turner
Рет қаралды 17 М.
String In Char Array VS. Pointer To String Literal | C Programming Tutorial
9:58
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН