- [Instructor] Hi everyone.…I'd like to talk about constructors…and the best ways to use them.…Now, a constructor can be created using…a snippet that Visual Studio provides.…Spelt out as ctor, and when I hit tab tab,…it immediately creates a constructor…for our Actor class.…Now, a couple of points about constructors…that I'd like to make is that they're…a method in a class that is executed…when an instance of the class is created.…
Now, it has the same name of the class…as you can see here on line 11.…And this particular constructor…is called a default constructor…and it has no parameters.…And it's actually not required…for you to put it in but when you…do not C# will create an implicit…constructor for you.…Now we can also have a parametrized…constructor where you can pass in parameters.…Lets go ahead and create one.…
And lets say I want to pass in…an actor name.…Well, lets go ahead and create…a property for that.…And I'll use another code snippet…called propfull.…And I want to be consistent with my naming.…So I will call this, actorName.…
- Naming and handling classes
- Running a unit test
- Using constructors
- Naming and handling methods, fields, and properties
- Using properties correctly
- Managing objects efficiently
- Common design patterns as best practices
Skill Level Intermediate
1. Best Practices: An Overview
2. Naming and Handling Classes
3. Naming and Handling Methods, Fields, and Properties
4. Managing Objects Efficiently
5. More Best Practices Resources
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.