Class Member Functions (aka Methods) | C++ Tutorial

  Рет қаралды 34,479

Portfolio Courses

Portfolio Courses

Күн бұрын

Пікірлер: 28
@mattmjlg5053
@mattmjlg5053 2 жыл бұрын
Dude these are the best tutorials on oop I couldn’t find detailed info on constructors except here!
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
I'm really glad that you enjoy them! :-)
@leythecg
@leythecg Жыл бұрын
No one explains it better & in such a short time! Thank you very much!
@KuchAmorphous
@KuchAmorphous 3 ай бұрын
Making it easier then my lecturer❤
@massimorusso3894
@massimorusso3894 Жыл бұрын
Video eccezionale sul c++. Un saluto 👍 dal'Italia
@PortfolioCourses
@PortfolioCourses Жыл бұрын
Grazie! :-)
@floatoss
@floatoss Жыл бұрын
Hey Kevin, I appreciate your lectures a lot! But can I ask you to also give an explanation, as to "what" actually happens in the background when we declare methods for an object type? Like, when I try to relate class to "structs" in C, I can see that each structure variable has many components as defined by us, and that several such structure variables will have their own variables of the same type as declared in the structure definition ( I am very comfortable to think in terms of memory diagrams ). But in here, I think I can correlate the variables being defined in the class, but what about the functions? Does each instance of the class have it's own function? Or is it a single function that is declared to the whole class, and somehow under the hood, we have function pointers and stuff like that? Also, when would we require to have a private function that takes no arguments at all? Like you gave an example of Area in this video, I don't see it serving any additional benefit than having it as a public one. So when would we actually even require private methods?
@dr_bodling
@dr_bodling Жыл бұрын
Love your videos! Quick question -- why would you need to define the class member function outside the class definition?
@PortfolioCourses
@PortfolioCourses Жыл бұрын
Good question! It’s very popular in practice to define the functions outside the class, because it separates the definition of “the interface” from “the implementation”. When we define the functions in the class we need to scroll through all the function definitions to see what functions are actually present. If just the function prototypes are in the class, then we can very easily see the “interface” of the class in terms of what functions are available. Some people say it’s bad to define member functions in the class but for small classes this is fine and may even be more readable. :-)
@dr_bodling
@dr_bodling Жыл бұрын
@@PortfolioCourses ahh I see! That makes sense now. Thanks so much for the thorough explanation! :)
@M10-r8q7h
@M10-r8q7h 8 ай бұрын
Aaaaaàaaaaaaaaa​@@dr_bodling
@daivshow4574
@daivshow4574 7 ай бұрын
@@PortfolioCourses omg thank you so much < 3
@safi955
@safi955 Ай бұрын
Great explanation , I preffer a dark editor :)
@Jose-kv4uh
@Jose-kv4uh 2 жыл бұрын
I like your teaching.... tell the name of the editor to download
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
I'm glad that you enjoy the way I'm teaching the concepts! :-) In this video I am using Xcode, which is an editor that is available on Mac computers. :-)
@aadhuu
@aadhuu 2 жыл бұрын
I'm done with C in my first semester. My second semester started and we have C++. I haven't explored many things in C++ yet. But from what I've seen, except cin and cout all basic things like arrays, structures worked with the same syntax. Why is it so that only input and output operations have different syntaxes? (I made another catch, that is we don't need to use type specifiers while using these input output operations which is a bliss)
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
You can actually still use printf/etc in C++ too! But streams are a more object oriented approach... for example the > operators can be made to work with objects of new types that we define, something we can't really do with printf. :-)
@aadhuu
@aadhuu 2 жыл бұрын
@@PortfolioCourses ohhh. That's interesting. Thank you!!
@vscs7415
@vscs7415 Жыл бұрын
what compiler do you use?
@PortfolioCourses
@PortfolioCourses Жыл бұрын
In this video I am using Xcode on a Mac which I believe uses the gcc compiler (or Clang).
@laughtersforever1
@laughtersforever1 2 жыл бұрын
But If we define member function outside class?
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
They're still member functions in that case. 🙂
@Jose-kv4uh
@Jose-kv4uh 2 жыл бұрын
please which editor is that
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
In this video I am using Xcode, which is an editor that is available on Mac computers. :-)
@rezahajivand7498
@rezahajivand7498 Жыл бұрын
Hello. And thanks 🎉
@PortfolioCourses
@PortfolioCourses Жыл бұрын
Hello. And you’re welcome! :-)
@michaelngatia4543
@michaelngatia4543 Жыл бұрын
👏👏👏
@PortfolioCourses
@PortfolioCourses Жыл бұрын
I'm glad you enjoyed it Michael! :-)
Constructor Basics | C++ Tutorial
7:08
Portfolio Courses
Рет қаралды 32 М.
Friend functions and classes in C++ (Programming for beginners)
18:18
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 846 М.
Introduction to the C++ Programming Language
3:59:55
Dave Churchill
Рет қаралды 25 М.
Friend Functions | C++ Tutorial
13:05
Portfolio Courses
Рет қаралды 11 М.
Why You Shouldn't Nest Your Code
8:30
CodeAesthetic
Рет қаралды 2,8 МЛН
C++ classes: static and instance class member variables and functions [1]
9:38
Professor Hank Stalica
Рет қаралды 7 М.
Public And Private Access Specifiers | C++ Tutorial
8:49
Portfolio Courses
Рет қаралды 48 М.
Class Templates | C++ Tutorial
12:48
Portfolio Courses
Рет қаралды 58 М.
Object Oriented Programming (OOP) in C++ Course
1:30:26
freeCodeCamp.org
Рет қаралды 2,6 МЛН
how Google writes gorgeous C++
7:40
Low Level
Рет қаралды 981 М.
Functions in C++
9:50
The Cherno
Рет қаралды 519 М.
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН