Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
So what happens if you write a class that never gets instantiated? Well, this can be a useful technique in Object Orientation. I've shown this example of the BankAccount collection of classes where we have a BankAccount class defined at the top with accountName and balance, deposit behavior, and withdrawal behavior. And then we have three more specialized classes that inherit from it, CheckingAccount, SavingsAccount, InvestmentAccount, and so on. But during the process of writing this, we might realize that will only ever instantiate an actual CheckingAccount or SavingsAccount or some other specialized account, we'd never actually instantiate a BankAccount class.
Now if that's the case, this class can be considered an abstract class. It exists purely for the sake of being inherited. Abstract classes are never instantiated. Now this class is still incredibly useful, it can contain functionality, methods, variables, and so on because they'll all be inherited. So it exists to provide shared behaviors. In some languages like C# or Java, you can explicitly mark a class as Abstract when declaring it, which means the language won't allow it to be instantiated.
And you must inherit from it before instantiating an object. Actually, the VB.NET keyword to enforce this is must inherit. But in other languages there is no official word for this, so you can just do it by a mission--just don't create an object from this class. Although with dynamic languages like Ruby, this kind of formality is not supported by design, it's just not the way that Ruby works. It's a much more common technique in C#, Java, VB.NET, and C++. So if that's an abstract class, a name for a class that can be instantiated.
Well, if don't say otherwise, we just assume that all classes can be instantiated but just as a term to use to distinguish them from abstract classes you can refer to a class that can be instantiated as a concrete class.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 98365 Viewers
61 Video lessons · 85659 Viewers
71 Video lessons · 69596 Viewers
56 Video lessons · 101918 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.