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?
You absolutely could. Just throw everything into a .h file and #include that. It's purely preference and how close to some standards you want to follow.
@@ProfessorHankStalicasir dp u have a vdo on iostream file, the stream concept is very complex for me and specily the > operator. I have problems specifically when we use the operaror overloading comcept with the extractipn operaror where we treat the cout as an operand and object along with ostream as the class. I have problems regarding the iostream classes and understanding the objects of them specifically
@@sayanhalder6470 I think this might be what you are looking for: th-cam.com/video/YHI5xamiheA/w-d-xo.html Don't forget that TH-cam channels have a search function. Go to the channel landing page www.youtube.com/@ProfessorHankStalica and next to the About link is an hour glass. Click that and you can search the channel for whatever you are interested in. You can also click the Playlists link to scan through that too.
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.
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?
'#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'
Supported, but not standard and not always reliable. en.wikipedia.org/wiki/Pragma_once en.cppreference.com/w/cpp/preprocessor/impl #ifndef, #define, #endif works 100% of the time all of the time.
You are an amazing teacher. Thank you! I wish you were my professor
Who am I to argue with someone with such obvious intelligence?
Me too!! Very easy to understand and speaks very clearly!!@@ProfessorHankStalica
thank you for explaing macros in a proper manner
Glad it was helpful!
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 💜💜
Glad it was helpful!
What a great video. It helped a lot
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?
You absolutely could. Just throw everything into a .h file and #include that. It's purely preference and how close to some standards you want to follow.
@@ProfessorHankStalicasir dp u have a vdo on iostream file, the stream concept is very complex for me and specily the > operator. I have problems specifically when we use the operaror overloading comcept with the extractipn operaror where we treat the cout as an operand and object along with ostream as the class. I have problems regarding the iostream classes and understanding the objects of them specifically
@@sayanhalder6470 I think this might be what you are looking for: th-cam.com/video/YHI5xamiheA/w-d-xo.html
Don't forget that TH-cam channels have a search function. Go to the channel landing page www.youtube.com/@ProfessorHankStalica and next to the About link is an hour glass. Click that and you can search the channel for whatever you are interested in. You can also click the Playlists link to scan through that too.
@@ProfessorHankStalica ah Thanks!! i was looking for this. I was wandering if I could declare and define all in the header file.
hello professor how to run this on Visual Studio thank you.
Hi, not sure I understand the question since I use Visual Studio in the video.
Great stuff 🙂
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.
It doesn't have to be this way. You could put them all in the same header file, but this is an option and common practice.
professor is there any assignment that would help us in each lesson ? and THANKS FOR YOUR EFFORT
Yes, but to see them, you need to be in my class and you are welcome.
@@ProfessorHankStalica how is thay possible ?
Thank you so much ❤❤❤❤❤❤❤
You're welcome 😊
Really great video
Thanks!
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?
No, you place it in a folder that's in the path for your IDE and then you can just #include "yourheader.h"
'#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'
Supported, but not standard and not always reliable.
en.wikipedia.org/wiki/Pragma_once
en.cppreference.com/w/cpp/preprocessor/impl
#ifndef, #define, #endif works 100% of the time all of the time.
Thank you!
You're welcome!
Thank you so much!!
You. Are. Welcome. So. Much. ❤
thank you!
You're welcome!
You must be good with the ladies the way you clearly explain things🧑💻
Oh yeah. You should hear me explain virtual functions in my Isaac Hayes voice. Gets 'em every time.
great