This video is like a needle in a haystack. So valuable. Thank you so much!
@DanielMojoli11 ай бұрын
Eloquent and beautifully thought. Every C++ novice should watch this.
@ekandrot7 жыл бұрын
For the slide "Method pointer data type" at 12:16, wouldn't the calling convention be "bool data = (foo.*myMethod)(row, col);" because you have a local foo? (I tested it to verify)
@CopperSpice7 жыл бұрын
Great catch! Thanks for the comment. You are correct. In our production code, we rarely call a method pointer on an object so we overlooked this point.
@tiennguyenviet48376 жыл бұрын
Can you explain for me 7:52 "pass by reference means only a reference to the data is pass and not the actual data"
@CopperSpice6 жыл бұрын
Thanks for your question. In C++ there are two fundamental ways to pass data to a method or function. One is by value, and the other is by reference. Passing by value means the called function receives an exact copy of the original data. As a silly example, if the data is an orange and you pass by value the function will receive a copy of the orange. You can think of pass by reference as giving the called function a piece of paper indicating where the orange is. If the orange is passed by reference and the called function peels the orange, the caller will see the modification to the orange since no copy was made. There are tradeoffs to the decision of passing by value or by reference. The decision is typically based on whether modifications should be seen outside of the function, and how expensive it is to copy the data. I hope this helps. If you have other questions feel free to let us know.
@tiennguyenviet48376 жыл бұрын
thankyou so much. yesterday, i find answer for my issue on internet. I really thank for your help. it's helpful answer
@김진오-j3p5 жыл бұрын
Is there any documents or video that explain how Pointer and Reference are different in detail? (10:40) Is it related to the Const?
@jvsnyc3 жыл бұрын
Sorry it is so late, but this video definitely goes over the very basic differences very thoroughly: kzbin.info/www/bejne/qKK5iJ1mlruGrsk The whole video is good, but your question is answered at 52:21.
@nexusclarum80007 жыл бұрын
This is a fantastic video. One thing I realized is that in my mind I always pronounced things oddly. While I always knew "char" is short for "character" I would still pronounce "char" in my head as in "charcoal" and "enum" which is short for "enumeration" as "e" and "num" together. Hmm... I wonder if I could use a method pointer to get around the problem I had before... I was mapping function pointers to strings in std::map in a method. But for it to work I had to make all the methods static and therefor none of the methods could modify non-static members.
@CopperSpice7 жыл бұрын
Thank you so much for your feedback. We are happy to know you enjoyed the video and learned something. It sounds like you might have a question about using a method pointer. Please feel free to post a question about your code on our forum. Under CopperSpice we set up a topic which is labeled "KZbin Channel". forum.copperspice.com/
@Bob-zg2zf4 жыл бұрын
Lmao. I too have been saying "charrr"...
@konstantinossimatos3466Ай бұрын
Let's take list, or hash or.... Is a list a data type or list is a data structure where you can save, retrieve... data types?
@CopperSpiceАй бұрын
Every object has a data type and a value. Containers like hash, vector, or list are Compound Data Types. The definition of a Compound Data Type is a type which is derived from other types. A data structure is normally implemented as a Compound Data Type. The operations a given type supports is not related to whether it is a primitive type, built in type, or a compound data type.
@罗登-j7n4 жыл бұрын
Where can I download the .ppt of .pdf files and the demo code you presented? I can not find them on the given website or download link. Is that avaiable? I just want to use it for personal study, thank you.
@CopperSpice4 жыл бұрын
You can watch these videos as many times as you like and study them as you go. Experimenting with the samples is a great idea and it is good practice to type unfamiliar code. You may even want to close the video and try to type the sample from memory just to see how much you can remember.
@cpp11583 жыл бұрын
Great stuff
@SandburgNounouRs6 жыл бұрын
After viewing this video, I have a pending question: Since you talk about that, may you write some of the features aloud by reference that are not by pointers?
@CopperSpice6 жыл бұрын
I am not sure I understand your question. However, if you are asking "what can references do which pointers can not" one good example is the ability to extend the lifetime of a temporary object by binding it to a const or rvalue reference. This lifetime extension is not available for pointers.
@jvsnyc3 жыл бұрын
Sorry it is so late, but this video definitely goes over the very basic differences very thoroughly: kzbin.info/www/bejne/qKK5iJ1mlruGrsk The whole video is good, but your question is answered at 52:21.
@aj-uo3uh Жыл бұрын
Why would you call a function pointer a datatype, its not data.
@CopperSpice Жыл бұрын
A "data type" refers to the contents which is stored in a given object. Every variable has two parts, a data type and a name. So "int counter" declares a variable named "counter" which stores data of type int. If you have "Widget (*ptr) ()" this declares a variable named "ptr" which stores a "pointer to a function". A "pointer to a function" is another name for a "function pointer".
@mage1over1374 жыл бұрын
I guess C++ didn't exist before C++98 since it's always been in C++ and was added in C++98.
@CopperSpice4 жыл бұрын
The first ISO standard for C++ was released in 1998, however the language was first available in the mid 1980s. Having a standard for the language has its pros and cons. Take a look at our video about the ISO standard for more information: kzbin.info/www/bejne/qXnWZ3-Bps2Dl6s
@jvsnyc3 жыл бұрын
Ha, I see that like myself, you used to call function objects functors, and have since ceased to do so. I also have stopped, because your later talks told me to.
@CopperSpice3 жыл бұрын
Actually, we personally never used the term "functor" in our communication or work. This distinction was added to clarify that not all computer science terms apply to C++ and we should strive to be clear about all terminology.
@tetramaximum7 жыл бұрын
Thank you very much for your videos, they are very very good, clean and short! I have found some typos though, which may confuse the newcomers. At 12:20 you use "foo->", but foo is not a pointer, it should be "foo." instead. Moreover, you did not take an address and call the pointer, which leads to the crash of course. Here is the short proof: coliru.stacked-crooked.com/a/9f7161b3145f66d6
@CopperSpice7 жыл бұрын
Thanks for the comment! As you and Edward Kandrot both noticed, we had a typographical error on the slide. You are correct, it should have been "foo.*"
@bonbonpony4 жыл бұрын
Quite complicated "Beginning" :q
@zishiwu77574 жыл бұрын
As Joel Spolsky says, all abstractions are leaky and C++ exposes you to a lot more details than other languages with garbage collection (Java, Python, etc.) would.
@bonbonpony4 жыл бұрын
@@zishiwu7757 I wasn't talking about C++ (which I know pretty well). I was talking about the style of this lecture.