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

  Рет қаралды 26,156

Portfolio Courses

Portfolio Courses

Күн бұрын

The basics of using class member functions (also known as methods) in C++ for object-oriented programming. Source code: github.com/portfoliocourses/c.... Check out www.portfoliocourses.com to build a portfolio that will impress employers!

Пікірлер: 29
@mattmjlg5053
@mattmjlg5053 Жыл бұрын
Dude these are the best tutorials on oop I couldn’t find detailed info on constructors except here!
@PortfolioCourses
@PortfolioCourses Жыл бұрын
I'm really glad that you enjoy them! :-)
@mba2ceo
@mba2ceo Жыл бұрын
@@PortfolioCourses the explanations really help
@leythecg
@leythecg 10 ай бұрын
No one explains it better & in such a short time! Thank you very much!
@massimorusso3894
@massimorusso3894 Жыл бұрын
Video eccezionale sul c++. Un saluto 👍 dal'Italia
@PortfolioCourses
@PortfolioCourses Жыл бұрын
Grazie! :-)
@mba2ceo
@mba2ceo Жыл бұрын
Great teacher :)
@PortfolioCourses
@PortfolioCourses Жыл бұрын
I'm glad you enjoy the teaching! :-)
@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! :)
@user-qo6vg5jb6y
@user-qo6vg5jb6y 2 ай бұрын
Aaaaaàaaaaaaaaa​@@dr_bodling
@daivshow4574
@daivshow4574 2 ай бұрын
@@PortfolioCourses omg thank you so much < 3
@rezahajivand7498
@rezahajivand7498 7 ай бұрын
Hello. And thanks 🎉
@PortfolioCourses
@PortfolioCourses 7 ай бұрын
Hello. And you’re welcome! :-)
@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!!
@Jose-kv4uh
@Jose-kv4uh Жыл бұрын
I like your teaching.... tell the name of the editor to download
@PortfolioCourses
@PortfolioCourses Жыл бұрын
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. :-)
@vscs7415
@vscs7415 8 ай бұрын
what compiler do you use?
@PortfolioCourses
@PortfolioCourses 8 ай бұрын
In this video I am using Xcode on a Mac which I believe uses the gcc compiler (or Clang).
@michaelngatia4543
@michaelngatia4543 Жыл бұрын
👏👏👏
@PortfolioCourses
@PortfolioCourses Жыл бұрын
I'm glad you enjoyed it Michael! :-)
@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?
@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 Жыл бұрын
please which editor is that
@PortfolioCourses
@PortfolioCourses Жыл бұрын
In this video I am using Xcode, which is an editor that is available on Mac computers. :-)
Constructor Basics | C++ Tutorial
7:08
Portfolio Courses
Рет қаралды 20 М.
Introduction To Classes And Objects | C++ Tutorial
11:49
Portfolio Courses
Рет қаралды 48 М.
DEFINITELY NOT HAPPENING ON MY WATCH! 😒
00:12
Laro Benz
Рет қаралды 27 МЛН
تجربة أغرب توصيلة شحن ضد القطع تماما
00:56
صدام العزي
Рет қаралды 32 МЛН
ОСКАР vs БАДАБУМЧИК БОЙ!  УВЕЗЛИ на СКОРОЙ!
13:45
Бадабумчик
Рет қаралды 4,7 МЛН
you will never ask about pointers again after watching this video
8:03
Low Level Learning
Рет қаралды 2,1 МЛН
Public And Private Access Specifiers | C++ Tutorial
8:49
Portfolio Courses
Рет қаралды 35 М.
Static for Classes and Structs in C++
9:12
The Cherno
Рет қаралды 344 М.
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 741 М.
Buckys C++ Programming Tutorials - 13 - Using Variables in Classes
9:12
thenewboston
Рет қаралды 1,1 МЛН
Abstract Classes And Pure Virtual Functions | C++ Tutorial
11:05
Portfolio Courses
Рет қаралды 15 М.
C++ OOP - What is inheritance in programming?
16:32
CodeBeauty
Рет қаралды 137 М.
Member Initializer Lists | C++ Tutorial
23:10
Portfolio Courses
Рет қаралды 8 М.
this Keyword And Use Cases Explained | C++ Tutorial
10:30
Portfolio Courses
Рет қаралды 5 М.
Smart Appliances! New Gadgets, Versatile Utensils, Tool Items #shorts #gadgets 149
0:15
Speed punched Messi 🫢🥊
0:50
GoalAntics
Рет қаралды 14 МЛН
Сумасшедший бассейн с волнами в Китае
0:16
Короче, новости
Рет қаралды 8 МЛН
УДИВИЛА МЛАДШУЮ СЕСТРУ
0:50
Li ALINA
Рет қаралды 6 МЛН
Эй Рамазан # DamirAgroDizel
0:17
DamirAgroDizel
Рет қаралды 7 МЛН
Как красиво снять полет #marim #shortsvideo
0:15
I chose the biggest glass 😂👻
0:19
Ben Meryem
Рет қаралды 24 МЛН