Separating a C++ class into a .h and .cpp files

  Рет қаралды 140,947

drprventura

drprventura

Күн бұрын

Пікірлер
@44mod
@44mod 5 жыл бұрын
Thank you so much for explaining everything to an old man of 55 who just likes to learn. My body is worn but i am trying to keep my mind working. Again thank you for your videos and God Bless You!
@ahmedtalaat27
@ahmedtalaat27 3 жыл бұрын
Actually old is all about mind not the age...
@chriseberle4234
@chriseberle4234 3 жыл бұрын
You still code?
@44mod
@44mod 3 жыл бұрын
@@chriseberle4234 yes still trying to learn. I love the challenge!!
@grandmakisses9973
@grandmakisses9973 3 жыл бұрын
@@44mod congrats any advice for a 17 year old?
@44mod
@44mod 3 жыл бұрын
@@grandmakisses9973 Just keep it fun. My oldest granddaughter was drawing a house on a piece of paper. I showed her how to take that drawing and use Fusion and then draw a squire, the offset the lines and then extrude. She then put a larger square on top and extrude. next came the chimney and she cut hole through wall and make windows. I said what do you think about that? She was amazed then I said, would you like to see what it looks like in real life? Yes she said and I saved it as 3d .stl file and 3D Printed a small version. She could not be leave she went from a drawing to a real house in a couple of hours!! Thank you fusion 360!!!
@zigydk
@zigydk 4 жыл бұрын
This was a tremendous help to me, coming from another language to C++. Thank you.
@themagnificiantmagnus
@themagnificiantmagnus 4 жыл бұрын
Exactly the same for me. Coming from C# to C++, this made light in something that I was struggling with.
@Droid2020
@Droid2020 4 жыл бұрын
You have no idea how much this helped me. I seriously had no idea how to create another file within my project and I was starting to go a little crazy.
@ISKLEMMI
@ISKLEMMI 3 жыл бұрын
Thank you for explaining this super clearly! I've been looking at moving to C++ from C for some of my projects, and this is one of the things that's confused me. Your video helped the idea click in my head.
@Retro105-26
@Retro105-26 6 жыл бұрын
this guys voice sounds like robert california's from the office. lol
@MattMaggioChannel
@MattMaggioChannel 5 жыл бұрын
Hahahaha that’s so true, I love it
@salbertus2578
@salbertus2578 4 жыл бұрын
I was thinking the turtle in sly cooper.
@MattMaggioChannel
@MattMaggioChannel 5 жыл бұрын
Do more videos, seriously. Great job. You get straight to the point and fast. Only recommendation is maybe higher quality recording?
@rudylucas4379
@rudylucas4379 3 жыл бұрын
Geez!! Best damn explanation of the "why". Please teach at my university.
@alucard64music61
@alucard64music61 2 жыл бұрын
Thanks for Your Video. You Saved my First big Project that I´m working on since 4 months.😃
@brendanklaus4199
@brendanklaus4199 5 жыл бұрын
Thank you! This is third video I watched about this topic, you're the only one that explained the Student:: concept. The only constructive criticism I can give you was there were way too many "uhs" and "ums". I don't know if the bother everyone, but man it was painful. Cheers!
@goham2558
@goham2558 4 жыл бұрын
Quit whining pussy
@foluobidare957
@foluobidare957 4 жыл бұрын
Thanks for explaining explicitly!
@shaynerushton214
@shaynerushton214 3 жыл бұрын
Nice. Concise. Cold as Ice! Thanks, man.
@owenhobbs1758
@owenhobbs1758 6 жыл бұрын
Thanks, this video really helped me out!
@epicretrogamingx7351
@epicretrogamingx7351 Жыл бұрын
than you very much, i wrote all my code in the .h file and was wondering what the hell i was doing
@drekforder2952
@drekforder2952 2 жыл бұрын
You explained it very well but what are the actual benefits if splitting it up like this? What is it good for?
@victoria_kirilova
@victoria_kirilova 3 жыл бұрын
Thank you soo much. You can't tell how much you help new beginners like me.. Thank you !
@EricCastorina-vv1ww
@EricCastorina-vv1ww 2 жыл бұрын
What does the last line of code in the .h file that starts with friend mean/do?
@superdahoho
@superdahoho 5 жыл бұрын
thank you so much, you're helping me a lot more than I expected
@freewhitesparrow6205
@freewhitesparrow6205 6 жыл бұрын
Dat voice
@drprventura
@drprventura 6 жыл бұрын
:)
@DA-rp1wg
@DA-rp1wg 2 жыл бұрын
Great tutorial , clear and fluent explanation, Thank you!
@Samtheabsoluteunit
@Samtheabsoluteunit 2 жыл бұрын
Explained very clearly and helped a lot!
@sherifayakubu1987
@sherifayakubu1987 4 жыл бұрын
Thanks for the video it was very helpful. I have two questions where would you place the initialization of static member variables of the class would it be in the .h or .cpp and can you use #pragma once instead of the #ifndef and #define
@GaryPaluk
@GaryPaluk Жыл бұрын
Whilst #pragma once is widely supported, it isn't actually standardized and as such, if you want to ensure that your code is more portable, it's advised to use header guards.
@Kelsatar
@Kelsatar Жыл бұрын
Hi. When i declare de class in a .h file and the te implementation in a .cpp file, the code does not compile, it's seems to be a problem of comunication with de .h file and the .cpp file. But, when I declare and implement de Class en the same .h file, the program in main runs successfully. It's seems to be a problem in the compiler.
@kevinjad4506
@kevinjad4506 5 жыл бұрын
When you speak, you look for my soul!
@alecvan7143
@alecvan7143 Жыл бұрын
Is it just me, or does your voice sound like James Spade? hahaha. Great video, thank you
@Jawu523
@Jawu523 5 жыл бұрын
I still don’t understand how in Ostream you don’t have to specify Student::
@nuut6976
@nuut6976 3 жыл бұрын
I get collect2.exe: error: ld returned 1 exit status when I run please help
@victorkomolafe4982
@victorkomolafe4982 2 жыл бұрын
same here... Please have you solved the error yet
@patapon3051
@patapon3051 4 жыл бұрын
Great voice and explanation, Thanks
@telecomnuggets1590
@telecomnuggets1590 4 жыл бұрын
By no means an expert, but everything I have read said to not use "using" in the header files. It kind of breaks the basic reason for having Namespaces.
@kareem.582
@kareem.582 2 жыл бұрын
Wow you're good at asmr
@VictorGarcia-it8gc
@VictorGarcia-it8gc 3 жыл бұрын
You are the man. Thank you for this.
@ashish902
@ashish902 3 жыл бұрын
Thanks. Really good explanation sir.
@billal1147
@billal1147 2 жыл бұрын
Thank you so much. Really good explanation and the video is useful.
@cosmiclyrics2307
@cosmiclyrics2307 4 жыл бұрын
I get the .h and .cpp file names as *Project_name/class.h* Its not a big issue but when I have a longer project name and multiple class names which are pretty same it gets a bit annoying. Like Movies/movies.h and Movies/movie.h How do I make it so that the file names show up like yours do?
@hugomaia6449
@hugomaia6449 2 жыл бұрын
You are amazing, thank you!
@liemh9290
@liemh9290 5 жыл бұрын
question: if i take .h ,file .cpp file, main.cpp file move to a new location do I HAVE to re-link it with the IDE like Codeblock or Visual? Is there a way around this?
@albinbergstrand9416
@albinbergstrand9416 6 жыл бұрын
thanks i had a book discusin this and it did a horrible job explaning it. you made me understand at once.
@belagore9862
@belagore9862 5 жыл бұрын
very informative thank you!
@leepoking
@leepoking 2 жыл бұрын
thanks man
@natalietran6382
@natalietran6382 6 жыл бұрын
Thank you so much! The video is really useful! :)
@dadycharso4905
@dadycharso4905 8 жыл бұрын
hi there, actually i was wondering how to initialize constructor in main?
@drprventura
@drprventura 8 жыл бұрын
Do you mean how to "call a constructor?" In that case, given the Student class above, in main you could do something like: Student s1 {"Bob", 1.5 }; // in C++11 and later Student s1("Bob", 1.5); // in C++ prior to C++11
@Synchr0nix
@Synchr0nix 7 жыл бұрын
the constructor is initialized automatically when you create an object of the class.
@EissaAlahdul
@EissaAlahdul 5 жыл бұрын
Thank you very very much!
@nidhidevi6235
@nidhidevi6235 6 жыл бұрын
is this necessary class name and header file name is same?
@drprventura
@drprventura 6 жыл бұрын
Great question! In fact, no the class name and filenames are not required to be the same in anyway. In fact there is nothing preventing you from defining multiple classes in the same file.
@nidhidevi6235
@nidhidevi6235 6 жыл бұрын
drprventura thanks 😃
@naoops4091
@naoops4091 6 жыл бұрын
Awesome video.
@mustafamahmoudahmed1778
@mustafamahmoudahmed1778 2 жыл бұрын
Here is a like to complete 1K likes on that helpful video. Thank you!
@wadewilson795
@wadewilson795 3 жыл бұрын
Thank you so much!
@elijahg1797
@elijahg1797 3 жыл бұрын
very helpful
@freddy4603
@freddy4603 3 жыл бұрын
thanks a lot!
@johnshapland6675
@johnshapland6675 7 жыл бұрын
thanks
@paurushgargtube
@paurushgargtube 4 жыл бұрын
Awesome
@michaelhernandez2075
@michaelhernandez2075 3 жыл бұрын
bro just think about what you are going to say before you say it. stop with the "uh's" and "umms" and repeating your sentence 3 times in a row.
@alexisreynolds4277
@alexisreynolds4277 4 жыл бұрын
Thank you!! This helped me a lot!
@TheLastOfTheMeheecanss
@TheLastOfTheMeheecanss Жыл бұрын
thanks
What are header files in C++ ( PROGRAMMING TUTORIAL for beginners)
23:54
Ful Video ☝🏻☝🏻☝🏻
1:01
Arkeolog
Рет қаралды 14 МЛН
-5+3은 뭔가요? 📚 #shorts
0:19
5 분 Tricks
Рет қаралды 13 МЛН
УЛИЧНЫЕ МУЗЫКАНТЫ В СОЧИ 🤘🏻
0:33
РОК ЗАВОД
Рет қаралды 7 МЛН
C++ Header Files
15:10
The Cherno
Рет қаралды 744 М.
BETTER Header Files and Preprocessor Debugging
24:26
The Cherno
Рет қаралды 75 М.
why do header files even exist?
10:53
Low Level
Рет қаралды 446 М.
C++ Tutorial for Beginners 29 - Placing Classes in Separate Files in C++
18:33
ProgrammingKnowledge
Рет қаралды 52 М.
C++ Programming Tutorial 84 - Classes And Objects
9:11
Caleb Curry
Рет қаралды 86 М.
C++ CLASSES & OBJECTS explained easy 🧍
10:54
Bro Code
Рет қаралды 41 М.
Ful Video ☝🏻☝🏻☝🏻
1:01
Arkeolog
Рет қаралды 14 МЛН