• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Classes and Subclasses

In OOP, you can create classes that borrow the properties and methods from other classes. For example, if the class SuperHero has a fly() method, you could create a SideKick class that borrows from the SuperHero class, and the SideKick class would then be able to fly() as well.

When we allow one class to use another's properties and methods, it is called creating a subclass. The SideKick class becomes a subclass of SuperHero.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint