Buckys C++ Programming Tutorials - 47 - Composition Part 2

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024

Комментарии • 396

  • @muaazhammad4446
    @muaazhammad4446 8 лет назад +194

    pretty cool huh x 3 XD

  • @moreorless6523
    @moreorless6523 8 лет назад +62

    you don't need to include every header file in every file. for example, in People.cpp you included People.h WHICH ALREADY INCLUDES Birthday.h. so its redundant to include Birthday.h in People.cpp.

    • @johnlarios87
      @johnlarios87 3 года назад

      is this why you don't need to add the " #include " to " People.cpp " ?

    • @MohammedAli-pr1uu
      @MohammedAli-pr1uu 3 года назад

      @@Astrax654
      it`s because u have used the include guard in your files
      this include guard prevents the header from being included several times in the same file
      note :
      many compilers insert this include guard automatically in the same moment of file creation

    • @joeyroman84
      @joeyroman84 3 года назад

      @@Astrax654 same here

  • @furusak81
    @furusak81 9 лет назад +56

    This is not a composition but it is aggregation because birthday can live without people. In order to be composition, birthday object have to be created inside people and not in main

    • @Limpuls
      @Limpuls 6 лет назад +5

      Yeah, more people should see it. Aggregation, association and composition are kinda similar but different things. I think because this is beginner series, Bucky just simplified it down to one term Composition without getting too much into details as it's already pretty confusing for beginners.

  • @pantrohuerta2664
    @pantrohuerta2664 3 года назад +3

    i've been about 4 hours triying to realise what to do with my c++ project and you just save me the life. Cheers

  • @MegaMovieCollections
    @MegaMovieCollections 10 лет назад +86

    pretty cool huh ! -- bucky favourite expression :P

  • @owenc.8288
    @owenc.8288 11 лет назад +41

    *come on dude, 30 videos left, you can do this!*

    • @TonyTxT
      @TonyTxT 4 года назад +1

      thanks ...i needed this

  • @mustafasen5085
    @mustafasen5085 4 года назад +17

    I swear my brain grew like 10% after this tutorial.

  • @alexanderthwgreat8744
    @alexanderthwgreat8744 3 года назад +1

    Even after five years, this video just gave me a better understanding of composition. Thank you lots

  • @YouShouldBeSpankful
    @YouShouldBeSpankful 12 лет назад +7

    This is the first time I see one of your tutorials.The way you make something so scary-sounding like "programming" and the many fancy words like "Composition" etc. become so easy and simple to understand and learn to a beginner,is what takes to be a good teacher.And you've really mastered it - congratulations to you. :)
    *Subscribe,fav,like*

  • @TheRationalFaith
    @TheRationalFaith 7 лет назад +21

    Pretty kool haan

  • @igpeev
    @igpeev 8 лет назад +9

    Bucky, your series ROCK ! A great fan of yours!
    One suggestion to this episode if I may: (min.6:45)
    EMPHASIZE the importance having line-12 and line-13 separated, instead of putting line-13 in the line-12 cout (a very intuitive looking, but a great way to spend a while TROUBLESHOOTING :) .
    RATIONALE - the func in line-13 returns nothing (void) - it by itself prints on the screen. If you put it in line 12, because the cout expects every function to return sth to work, and this function doesn't return anything - this leads to ERROR

    • @theseangle
      @theseangle 4 года назад

      It was obvious I think

  • @TrustNoOneEverEver
    @TrustNoOneEverEver 7 лет назад +5

    The best explanation of the notion of "Composition"
    Thanks Bucky, and it is indeed "pretty cool, huh" XD ;)

  • @bobmerhej4710
    @bobmerhej4710 4 года назад

    man i dont know what the f i would have done without your amaizng content!

  • @MontSteve36
    @MontSteve36 10 лет назад +6

    After watching again I now understand.

  • @Marius-vw9hp
    @Marius-vw9hp 7 лет назад

    To all of you people that DONT understand C++ but REALLY want to learn it:
    - Watch through all the tutorial videos from Bucky just to get a fast intro into the world of C++. DONT expect to learn anything from it. You cant learn C++ from watching a bunch of 5 minute videos, but you CAN get a fast intro to words and stuff you might recognize later.
    - (optional) Download Unreal Engine and learn to use the Blueprint system. This is fun as hell if you like amazing graphics, and will give you a great intro to coding i C++ (Unreal Engine is based on C++, and with blueprints you do it visually). Its free to download and in my opinion probably the strongest piece of software ever created. If you want to make games, you dont need to learn C++, you only need to learn Unreal Engine.
    - Do the CS50 course by Harvard! It is an introductory course to coding in C by Harvard. It is hard. Coding is hard. This is the least hard intro you can get IF you take your time and buy a complementary book to go along with the CS50 course. C++ is almost the same as C, only harder. So START with C, THEN go over to C++.
    - After doing the CS50, you are probably so good you can buy any "learn to code in C++" with a focus on what you really want to code (like "learn to code iphone apps in C++", or "learn to make games in C++").

  • @guy3027
    @guy3027 6 лет назад +3

    void buckycool()
    {
    cout

  • @riseoftech4k332
    @riseoftech4k332 8 лет назад +51

    pretty cool hun!!!

  • @SetYourHandle3
    @SetYourHandle3 9 лет назад +1

    Hello. In my country the school system in most of the highschools separate students in 2 "types of classes", one is for math,IT,physics,biology,chemistry, and one is for mothertongue,foreign languages,history,geography,philosophy,etc.
    Well i chose the easiest one which you can probably guess.Biggest mistake of my life. Well i was only 15... thats the sad part. They make us chose what are we going to do with our life at such an early age. 3 years had passed so far since then and now i want to study IT and get to an IT college which requires an entrace exam(c++). As I wasted my 3 years of highschool doing nothing now it's way too hard for me to learn such things as a programming language and especially learn it so i can beat other stdents at that college entrace exam.
    So far i got to this video from the tutorial.I lost it about 10 tutorials ago, but i hope after i finish the entire tutorial and i repeat it 2-3 times, ill be good-ish at C++.
    Btw, i dont think i'll ever get enough of that "pretty cool, huh?"

  • @DefenderX
    @DefenderX 8 лет назад +1

    These tutorials are very hard for me to understand. I have no experience with coding and I'm practically just copycatting all the code written, that said I really appreciate that Bucky's recapping everything after each session.
    Though what would make it much simpler for, so that I can understand is a picture showing each coding element with arrows pointing at the interaction of the coding element. Also an explanation why the coding element needs to interact with the specific file etc. would help.
    It's hard for me to understand by just watching text and listening because often I need a logical explanation and in beginner level tutorials people tend to teach without telling the entire truth behind certain things. For instance why this and why that.
    Great videos tho, will complete several of them.

    • @kylepoe5139
      @kylepoe5139 8 лет назад

      Questions: Have you worked from the beginning of these tutorials? And, are you stopping to make sure you understand everything he's written after each tutorial? I started coding 5 days ago and using Bucky's tutorials for 3 and this all makes perfect sense to me.

  • @Niffie
    @Niffie 10 лет назад +5

    Good flippin' lord! This was the most confusing program to code for me that by the time I got it right it felt like I just won a freakin' Nobel Prize! Woop!

    • @1014p
      @1014p 9 лет назад

      Should have my instructor, he is all over the place compared to this guy. At least he is specifically showing this in simple form and not crap like you would see with hardware. I learned more in the first 4 minutes of the last video than in the hour my iConnect did.

  • @YashasviGoel
    @YashasviGoel 7 лет назад

    Happy Birthday Bucky the king!

  • @redjr242
    @redjr242 12 лет назад

    Here may be the reason for people's problems with header files.
    1) Be absolutely sure that you have the #ifndef (token), #define (token) and #endif in every header file. This makes sure that if the file is included more than once, the preprocessor will erase it, effectively, only including it once.
    2) Avoid including the same things in a cpp and the header file, only put it in the header. step 1 takes care of this but its still good practice to do so.
    Hope this solves some people's problems.

  • @DaanSnqn
    @DaanSnqn 7 лет назад +2

    "You're saying: alright." (Times infinity)
    -Bucky Roberts

  • @Impulse_Photography
    @Impulse_Photography 5 лет назад

    this topic seems to be comfusing to many - Its all about the relationship. Inheritance ('Is A' relationship:: A Dog is an Animal) Composition ( Has A, relationship :: A Person Has A Birthday) Inheritance - - inherit the good, bad & ugly, composition include objects of other classes into your container class.

  • @maidasfood-tube8611
    @maidasfood-tube8611 3 года назад

    I knew my problem will get solved after watching Bucky's tutorial

  • @HarryAGeorgiou
    @HarryAGeorgiou 5 лет назад +1

    @thenewboston Happy Birthday, i happen to be watching this today :-)

  • @SamuelNKiap
    @SamuelNKiap 2 года назад

    Remember, birthdate is created outside of the constructor, therefore this video is about aggregation than composition since in composition contained object is created with the host object, where host object has total control over the contained object.

  • @MrSamisack
    @MrSamisack 9 лет назад

    I like your videos because of it's simplicity and buecause you speak an english that I easily can understand (i'm frim Spain). So, thank you!

  • @Zwolf11
    @Zwolf11 13 лет назад +3

    from 1:57 to 6:45 I was yelling at you in my head that you were forgetting to include the parameters in the constructor

  • @MrAitSous
    @MrAitSous 3 года назад

    WOOOW you've explained about composition in a nutshell. Thanks for this tutorial :)

  • @rmz1994
    @rmz1994 11 лет назад

    initializes the local variable name to the one provided and passes the object to the one from birthday, so after this, name is equal to the string provided and the birthday object has its info finally through the people class, so now print info function from the people class will cout the name and call the function print date with this object accesed from here throughh birthday. so printinfo does the whole final thing :)

  • @alphoxiel
    @alphoxiel 11 лет назад

    Ohhhh so Jueecy was saying that Bucky was passing the object by value okay. Thanks for clarifying it. This is good to know the dos and donts as a newbie.

  • @borisking7
    @borisking7 7 лет назад

    Happened to watch this tutorial on your birthday, happy birthday thanks for your work :)

  • @georgegeorgiev4005
    @georgegeorgiev4005 10 лет назад +4

    isn't using namespace std; in the header file flooding the main.cpp and better to use std:: before the string types?

  • @abekmuratov
    @abekmuratov 13 лет назад +1

    Awesome! Keep it up! Thanks from Kazakhstan!

  • @MontSteve36
    @MontSteve36 10 лет назад +5

    One thing has me confused here, I do not understand why the Birthday and the People constructors were initialized differently. nothing was declared as a constant.

    • @smartguycoder3106
      @smartguycoder3106 10 лет назад +1

      In People constructor,u use an object of another class in the program unlike Birthday constructor.

    • @beyondhelp
      @beyondhelp 7 лет назад

      Steve Hedemann its really just optional, it doesn't matter if you initialize in the body, or use the member initailizer, he's just showing both

    • @angus2170
      @angus2170 4 года назад

      @@beyondhelp I tried it just now, and I think that's partly right. I got errors when trying to initialise members of the people class non explicitly. Otherwise, yeah I think it is just preference.

  • @ThePhilosophyHub
    @ThePhilosophyHub 2 года назад

    Live long the king Bucky

  • @SantoshKuppens
    @SantoshKuppens 10 лет назад

    Those two video's really helped me alot! Thumbs up, thank you man! You're great :)

  • @krishnasaivootla8761
    @krishnasaivootla8761 8 лет назад +3

    Don't we need to include string class in the people.cpp??

  • @willfdz
    @willfdz 5 лет назад

    wow men fantastic rlly thx , i come from java composed class , switch to c++ composed class all the examples that i found was in the same main.cpp and the assholes of stackoverflow start to dicking around , i finally managed to understand thanks to you =)

  • @GBJaayy
    @GBJaayy 3 года назад +1

    How do you know when to use the member initialization list or to put it in the body of the constructor

  • @NiamulArifin
    @NiamulArifin 9 лет назад

    i had a difficult time understading composition but what i think of it as a egg and cheese bagel. If egg is considered to a class and its covered with cheese as another class, then drawing the final output in int main() will be easier

  • @ove4kin8
    @ove4kin8 11 лет назад +5

    guys, i keep getting errors, wtf

  • @archentity
    @archentity 11 лет назад

    For those people who took the short cut and put all the classes into a single source file, you have to declare the Birthday class before the People class. If the People class comes first the compiler won't know how to use the Birthday class inside of it because it hasn't encountered it yet. This is the problem I ran into.

  • @swetasamaddar7038
    @swetasamaddar7038 9 лет назад +4

    hey Bucky!! i love ur tutorials...
    i love ur teachin styles :P
    by d way m havin a little doubt...
    why didnt we use member initializers in birthday class for assigning date,month,year??? :/

    • @anshangbo
      @anshangbo 7 лет назад

      Because we do not initialize an object of other class, only three ints, month, day, year.

    • @Impulse_Photography
      @Impulse_Photography 5 лет назад

      You could have, but whenever you use the initializer list all objects created are initialzed with that same value.

  • @bostic8683
    @bostic8683 8 лет назад

    i was totally skeptical until this point that if i code anything but calculations and stuff but when u add creativity u can do anything

  • @cristiancarrillocastillo4807
    @cristiancarrillocastillo4807 6 лет назад

    Thank you so much Bucky I missed out on two points because I couldn't do this!

  • @sergyu123456
    @sergyu123456 13 лет назад

    @Olemassacre in the .h file you have all your functions. In cpp you have your functions coded. You include stuff in .h when you need it, like strings. You do not need to include namespace std because you do not use cin or cout there. You use them in the .cpp file. or that's how I got it. lol

  • @TheCareertalk
    @TheCareertalk 11 лет назад

    Ít's because if you ever become good enough at programming to do it in a professional setting you'll work in a team making these things all on your own. It's also so that you can hide your code if you're sharing it with other people. It's also just good design practice!

  • @TheBonkill
    @TheBonkill 10 лет назад

    How funny, Bucky, we share a birthday. 3 days after Christmas always getting shorted when it comes to gifts haha

  • @aperson4051
    @aperson4051 7 лет назад

    Why in the Birthday class, did they pass the parameters into the body of the birthday constructor, but for the People class, the parameters were passed in using the : name(x), dataOfBirth(bo) approach?

  • @SuperTipu10
    @SuperTipu10 4 года назад +1

    Every 2 seconds: Pretty cool, huh?

  • @leestallings9400
    @leestallings9400 11 лет назад

    check to make sure you named the actual printInfo function and declaration the same as the call to it(caps, underscores, etc). i know one of my most common mistakes is the caps and uncaps when naming and calling. printInfo isnt the same as PrintInfo

  • @sofija927
    @sofija927 8 лет назад +2

    Can someone please tell me why did he do this member initializing in People constructor, but did not do it in Birthday constructor, he entered the {} and wrote inside them normally month = m etc. Thank you!!

    • @sajibarafatsiddiqui9077
      @sajibarafatsiddiqui9077 7 лет назад +1

      either way it works... but I also have the same question.

    • @Alexmalism
      @Alexmalism 6 лет назад

      Because it's people who have birthday rather then the birthday has people.

  • @vijit2992
    @vijit2992 7 лет назад

    I'm watching your video on "28/12/2017"
    Happy Birthday !!!

  • @MikeM-py2hq
    @MikeM-py2hq 9 лет назад +6

    for some reason codeblocks won't build the main.cpp file.
    after restarting it worked, miracles do happen!

    • @Traxin91
      @Traxin91 9 лет назад +3

      Mike M This.. Fucking codeblocks error undefined reference to WinMain16.

    • @HugoIetsGaming
      @HugoIetsGaming 9 лет назад

      +Ticomfreak Codeblocks master race! If you don't screw it up

    • @alexc.5676
      @alexc.5676 9 лет назад +1

      +TeleTubbie Luver No, Eclipse master race!
      If you setup CDT correctly, then you can edit java and c++ files all together in one IDE

  • @Mark-qg5uh
    @Mark-qg5uh 7 лет назад

    I usually do Bucky's C++ tutorials on Visual Studio. I did everything precisely as he did, but received an error. However, I was able to solve it by adding the "#include " header to the People.cpp.

  • @TakatsoMolekane
    @TakatsoMolekane 11 лет назад

    Wow! Way better than my Lecturer

  • @MrTypingsound
    @MrTypingsound 10 лет назад +1

    Why didn't he use a member initializer list here, for when he assigned values in the constructor for the Birthday class?
    Could someone please explain in what cases you are to use a member initializer list and when you should just assign the values in the function body instead? Or will either method work all the time?

    • @Impulse_Photography
      @Impulse_Photography 5 лет назад

      My understanding is, and I use it in my constructor of my class, if you use the initializer list at the very instant the object is created it is set to the values. On the other hand, if you set the values inside the curly braces, it gets set after the object is created. For me, not much difference but i am sure there are some out there that can correct me if I am wrong, and maybe explain why you would need one over the other.

  • @goldse26
    @goldse26 11 лет назад

    So, in main, you first create the birthObj with some parameters to set the variables for the birthObj class -> day, month, year. Then, when creating the People Object and calling the constructor function, you pass this object, since you will want to use this object in the people class, as parameter. You're just giving the People class access to the Birthday class by passing this object, since in the people class, you then use the Birthday.printBirthday() function. I can't write more.

  • @pepe6666
    @pepe6666 7 лет назад

    i had a object as a member variable and i didn't need to use member initializer.
    i would like more clarification on why some times ya declare variables in the header and some times ya do it in the source file.

  • @AliVeli629
    @AliVeli629 6 лет назад

    I wanna cry.We can do easly without class files.But I believe you these informations will work in the future.

  • @rmz1994
    @rmz1994 11 лет назад

    In A Nutshell: A class was created called birthday, on its header under public it has a birthday function/constructor which intakes the date, below is the print date, and under private the variables not yet associated, on the birthday cpp the constructor sets the variables to the input date, then passes it to a function from the birthday class and couts them, cool. thats a complete object now people takes in the string for the name and the object including its functions and people constructor

  • @naitik1744
    @naitik1744 4 года назад +1

    This video was PRETTY COOL HUH?

  • @sharkPause1
    @sharkPause1 3 года назад

    Bucky IS the king

  • @CloudExile1
    @CloudExile1 2 года назад

    Where is Bucky??? It's been 7 months since a video!

  • @cabreram.4734
    @cabreram.4734 5 лет назад +1

    What I don't understand now is WHY use a different object name (bo) in the People constructor when it's going to be used the same birthObj created in main to access the Birthday class? WHY? I'm getting more and more confused each time ...... Is anybody around? !

  • @RedsBoneStuff
    @RedsBoneStuff 9 лет назад +7

    Grab a milkshake? I'll grab oranges instead XD

  • @photophoruphotographerpers1237
    @photophoruphotographerpers1237 10 лет назад

    Your videos are so Good, Thank You So Much.

  • @iainthomson7424
    @iainthomson7424 7 лет назад

    It took me a while to get my head around this but I think I got there in the end! I tried working through this example in CodeBlocks, I kept getting an error in my People.h saying that my string did not have a name type.
    After checking a few forums I found that I had to change my "string" declarations in the body of People.h to "std::string". Does anybody know why? Perhaps I changed some default settings.

  • @teeman9266
    @teeman9266 11 лет назад +2

    "When ever your working with an object, you need to 'inclu-l-l-l' it"

  • @ClaudiuB
    @ClaudiuB 7 лет назад

    hard to keep up, but hey, hard means provocative! good luck and practice using codeblocks, split your screen, left: codeblock, right: youtube

  • @Lunaticpandora101
    @Lunaticpandora101 13 лет назад

    @Chriscs7 oh i realised what the problem was. You have to include all the #ifndef #endif nonsense, so it should look identical to what Bucky's got. I think he said in another tutorial its not important but it actually is!

  • @DjZephy
    @DjZephy 13 лет назад

    Holy crap I actually got it to work after fixing only 5 errors!!!! Yes!!!!!!!!!!

  • @rolarola5915
    @rolarola5915 7 лет назад +2

    I am ready for the next tutorial, even without a milkshake hhhh :p

  • @devitvish
    @devitvish 4 года назад

    Happy Birthday!!!

  • @Darku.Matteru
    @Darku.Matteru 9 лет назад

    hello, thx for this tutorial, its great. but the topic is pretty hard. i definitely need more examples @composition. so what would you suggest me??

  • @ZiliasTheSaint
    @ZiliasTheSaint 8 лет назад

    You don't need to include birthday.h and namespace std in People.cpp. They are already included in header file....there's redundant calls.

  • @WaspLife
    @WaspLife 12 лет назад

    make sure you are properly assigning it data. read through your code make sure the variable names are passed correctly.

  • @luksports555
    @luksports555 11 лет назад

    Since those were private varibles. If you put that in another class, or even another part of that class, it would have no idea what month,day or year was.

  • @Veldr0N
    @Veldr0N 8 лет назад +43

    This is soooo hard :((
    So much stuff in so many different files is confusing :(
    Aaaand,i've come to the conclusion that i'm an idiot

    • @Veldr0N
      @Veldr0N 8 лет назад

      Ty

    • @Veldr0N
      @Veldr0N 8 лет назад +1

      Yeah well,i started to learn C++ as my first programming language just because that's what my dad wanted :P

    • @killarviper
      @killarviper 8 лет назад

      +VeldroN your dads stupid then, go to code academy.com and learn every language on there before you learn c++. Unless you understand the fundamentals of programming you will never understand c++.

    • @bostic8683
      @bostic8683 8 лет назад

      you should of started with a beginners language like pascal

    • @killarviper
      @killarviper 8 лет назад +2

      De Shad Bostic nahhhhh pascal is garbage. java is a terrible start too. python is probably the best language to start by far.

  • @Friedtunafish77
    @Friedtunafish77 13 лет назад

    @Cezarijus Actually, there is a way. All you need to do, is pack all the headers into one header called "Library.h" for example and include that into every file. Then, if you need to change the name of something, just change it in the Library header, not in each and every file. It is the easiest way :) Very efficient. This can be used for all kinds of libraries, global variables, namespaces and so on.

  • @arhaisme
    @arhaisme 10 лет назад

    this->x is the same thing as (*this).x, it's just a convenient shortcut

  • @zcarla3
    @zcarla3 7 лет назад

    Thanks king!! This is actually PRETTY COOL! hhaha

  • @southparkclips221
    @southparkclips221 3 года назад

    Care to explain what's the benefits of passing objects-names to empty-object member
    I don't see the benefits of doing it since you already have access it through header file

  • @tomerik8516
    @tomerik8516 6 лет назад

    Hello awesome tut! But 2 questions.
    First, if i dont want to pit #include in people.h becsuse reason.. how do i do it the other way?
    Second, so with this way of doing things i can now stop using innherance? Lol (not serious..)

  • @asnawimohamadnasir9009
    @asnawimohamadnasir9009 5 лет назад

    very helpful bro, thanks for the explanation : )

  • @Luix
    @Luix 7 лет назад

    I wonder why he uses the constructor differntly for birthday and for people.

  • @cubito455
    @cubito455 13 лет назад

    @Friedtunafish77 wouldn't that make you iinclude headers that you don't necessarily need? or it doesn't matter if you include a header file and don't use it?

  • @bam5932
    @bam5932 10 лет назад

    I keep getting this error. Any ideas as to why?
    mingw32-g++.exe: error: programs\youTube\Birthday.cpp -o obj\Debug\Birthday.o: No such file or directory
    Process terminated with status 1 (0 minute(s), 0 second(s))

  • @TheLancerb1
    @TheLancerb1 11 лет назад

    He is saying that you should pass objects, not functions from another class, to a function/method either by reference or const reference for efficiency.

  • @asian_delirium
    @asian_delirium 8 лет назад

    meant to ask this before: what is the difference between member initializer (the double colons thing before the body) and actually initialzing the values in the constructor? In this example: why write
    birthday::birthday(int d, int m, int y)
    {
    day = d;
    month = m;
    year = y;
    }
    instead of
    birthday::birthday(int d, int m, int y)
    :day(d), month(m), year(y){
    }
    in the birthday class? like he did in the people class? from previous videos i know that if the attribute is a const, then you need the member initialzer, but if it's a regular variable, what is the difference?
    both ran with no error and same output btw.

    • @moreorless6523
      @moreorless6523 8 лет назад

      +zzZMrWangZzz using the member initializer is more efficient since it does two operations in 1: declares the variable (allocate memory for it) and initialize it with a value AT THE SAME TIME. unlike when not using it, memory is allocated for the member variables first then LATER initialize it in the constructor body.
      the efficiency is better seen when initializing data members THAT ARE OBJECTS which inside them contain their own set of data members. when not using member initializer with objects, the objects default constructor wiill be called first and assign it with default values THEN LATER ASSIGN IT WITH the values you intend for it to have. ITS MUCH MORE EFFICIENT TO ASSIGN IT WITH THE DESIRED VALUES DURING ITS CONSTRUCTION AND NOT START WITH SOME DEFAULT VALUES.

    • @StickMan1316
      @StickMan1316 8 лет назад

      That's where you have to put the "syntax variables", it's just how the developers of c++ made it.

  • @hungrygrimalkin5610
    @hungrygrimalkin5610 10 лет назад

    Compostition is best left untouched , I try to use it the least amount of times I can and try not to mingle my classes unless there is absolutely no other way.

    • @HermanWillems
      @HermanWillems 6 лет назад

      Found the person who makes spaghetti code trough Inheritance... :P

  • @noxabellus
    @noxabellus 7 лет назад

    I dont understand when you use the weird member initializer syntax and when you dont

  • @justinsincoise6693
    @justinsincoise6693 8 лет назад

    this got me spinning after halfway.

  • @Biobird913
    @Biobird913 13 лет назад

    @thenewboston dang your birthday was 2 days ago.... I knew I should have watched this tutorial earlier

  • @treetoon-tf
    @treetoon-tf 12 лет назад

    Why isn't it necessary for the int's month, day and year to be initialized before the "Birthday(int m, int d, int y);" Is private or public ran first, at the same time?

  • @peaduaw1
    @peaduaw1 9 лет назад

    I got tripped up for a second because i tried to put dateOfBirth.printDate(); on the same line as cout

  • @lushlush3927
    @lushlush3927 4 года назад

    Is there a difference between doing:
    Person(string name, int age) {
    this->name = name;
    this->age = age;
    }
    Person(string name, int age):
    age(age),
    name(name)
    {
    }

  • @amanuel2135
    @amanuel2135 8 лет назад +3

    We should really place it into one file... Like im tired of placing 5 classes in 5 diffrent classes. We didnt reach that level yet.

    • @kylepoe5139
      @kylepoe5139 8 лет назад

      It's good practice.

    • @user-qn9ij6go2c
      @user-qn9ij6go2c 8 лет назад +1

      you can do what you think is easy for you but separating classes can help avoid confusion in a bigger project

    • @PoliticRevolutionnaire
      @PoliticRevolutionnaire 8 лет назад

      +targetghig nojhfgujfgj Really? I saw it as useful for team development but I always saw it easier to organize while in the same file as you have everything there you won't miss a class you can't see because you've opened tons of classes. Matter of preference I suppose.