Get immediate access to this and over 1,500+ other videos and books.

Boost your skills with a raywenderlich.com Beginner subscription. With over 60+ video courses and our core foundational programming books bundled in one subscription, it’s simply the best investment you can make in your development career.

Use Abstract Classes

This video was last updated on Jun 28 2022

Learn the concept of an abstract class and learn why abstract classes are useful in your program.

Contributors

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

You can unlock the rest of this video course, and our entire catalogue of books and videos, with a raywenderlich.com Professional subscription.

So far, things have been straightforward but with this episode, things are about to get a little abstract. I’m going to introduce you to abstract classes. But before we discuss abstract classes you need to understand the concept of an interface.

ImageGenerator generator = NetworkGenerator();
generator.fetchImage();
abstract class HelloWorld {

}
var hello = HelloWorld();
var message = 'Hello World!';
String getHelloString();
class BackwardsHello extends HelloWorld {

}
@override
String getHelloString() {
    return message.split('').reversed.join();
}
class ShoutyHello extends HelloWorld {
  @override
  String getHelloString() {
    return message.toUpperCase();
  }
}
HelloWorld hello = BackwardsHello();
print(hello.getHelloString());
hello = ShoutyHello();
print(hello.getHelloString());

Reviews

Comments