C++ Create Your Own Class Header Files [2]

preview_player
Показать описание
In this video, I show you how to write a class, separate it into specification and implementation pieces, and store them in separate files. In other words, how to create a header file.

We also cover preprocessor guards and why they are needed.

We'll use Visual Studio 2022 C++ in this C++ tutorial for beginners.

// Consider supporting this channel in multiple ways
Bitcoin: 177wfkQwzXiC8o2whQMVpSyuWUs95krKYB

// Learn More //
Рекомендации по теме
Комментарии
Автор

You are an amazing teacher. Thank you! I wish you were my professor

eduardogallegos
Автор

thank you for explaing macros in a proper manner

riotfist
Автор

thanks for making this tutorial it help me alot, i hope others may benefit from it, its a lot to learn i hope you keep teaching 💜💜

mr.shredder
Автор

You must be good with the ladies the way you clearly explain things🧑‍💻

PoetryInMotion
Автор

After creating a header file, what is the best way to use it in another project? Do I just need to create a new header file and copy and paste the code over each time?

emilioramirez
Автор

'#pragma once' is not limited to Windows compilers and is supported by most modern C++ compilers across different platforms.

Supported Compilers:
GCC (GNU Compiler Collection): Fully supports '#pragma once'
Clang: Fully supports '#pragma once'
MSVC (Microsoft Visual C++): Fully supports '#pragma once'
Intel C++ Compiler: Supports '#pragma once'
Apple's Xcode (using Clang): Supports '#pragma once'

dariusz
Автор

professor is there any assignment that would help us in each lesson ? and THANKS FOR YOUR EFFORT

lgt
Автор

Sir one question, sir instead of making two different files that is specification and implementation can we make one that is only the rectangle.cpp and add just that in the main. cpp? What will be the differences in this case and can we use the same logic of preprocessors that we used in the rectangle.h in this case?

I mean to say everything including the class and member function definitions in the rectangle.cpp and only including this in the main file and not create the rectangle.h at all?

sayanhalder
Автор

Hello, professor Hank! I'm a little confused why does it have to be this way in C++, implementation and specification files. To me, it would make more sense to have a class in a file altogether and import that in the main file.

alexandruteodor
Автор

hello professor how to run this on Visual Studio thank you.

boudalaakhadija