Classes / Class Specifiers
Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com’s entire library of video tutorials.
Learn More
Subtitles of the Movie
One last thing we need to talk about when it comes to classes is the different specifiers we can put on classes, and this controls who can use them or who can instantiate objects off of them. And this has to do with encapsulation and hiding details. First of all the public class, and this is what you've seen so far, in this on the examples on this course. Public, if we say public class Mark, that means anybody can create an object off of this class. So they can instantiate objects using this class, there's public access. If I have a class called private, private class Mark means that this class can only be created if it's nested inside another class, so only the parent class can call this class and instantiate an object off of it. The next one is a friend class and the friend class is accessible only in the program in which it is defined, so friend class Mark can only be instantiated, can only have objects instantiated off of it from other places within that program but not programs outside there. So it's not shared at all amongst other programs. Now protected, if I have the protected specifier on a class this means it's only accessible within the class itself and it's child classes. Which again means it's not exposed to the outside world, it's totally an inside job so to speak. And then protected friend is just a combination of the protected and friend, it's only allowed inside the same program and protected meaning within the class itself and it's child classes. Now you'll see these in your programming in various places in programs, and it just simply has to do with how much exposure outside of our program we want our classes to have. And keep in mind that sometimes inside a class we need more functionality and it just makes more sense to wrap all that functionality up in another class and instantiate objects off of that class. But we don't want these to be exposed to the outside world directly, and so we can nest these things inside there. So that's class specifiers and use these as you need to, to provide functionality with your program without cluttering up the interface, or offering things to the clients of your classes that they may not understand.
Tutorial Information
| Course: | Microsoft Visual Basic .NET |
| Author: | Mark Long |
| SKU: | 33433 |
| ISBN: | 1932072349 |
| Release Date: | 2003-05-27 |
| Duration: | 6 hrs / 87 lessons |
| Captions: | Available on CD and Online University |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |
VTC Sign up & Benefits
- Unlimited Access
- 98,729 Video Tutorials (23,265 free)
- Video Available as Flash or QuickTime
- Over 1026 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 