今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Struct pointers
- [Instructor] In this lesson, we'll see how we can make changes and keep track of them in our structs. We have an "author struck" with a "first" and "last string" fields, along with a "fullName" method attached to it. We want to add support for changing the name of an author, so let's jump to line 15, to declare it. We'll call this method "changeName." (computer keys clicking) We'll specify the receiver. (computer keys clicking) And we'll provide first, last, both are strings. We're now going to return anything and inside of the function, for the method, we'll change the "first" and assign the incoming "first" parameter and we'll do the same for "last." Okay, now let's jump down to "main," where we'll initialize an "author" and print this up, using the "fullName." Let's now run a program and see what we have so far. Okay, great. Now, we noticed that we have a typo in the name of the author. Thankfully we have our…