1 / 4

TUT #3 (of Tutorial3 :)

TUT #3 (of Tutorial3 :). Still CSCB07. Interfaces. Templates for Objects I nterface is a group of related methods with empty bodies Classes implement interfaces, agreeing to certain predefined behavior Cannot instantiate an interface(no constructors/variables)

yosef
Download Presentation

TUT #3 (of Tutorial3 :)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TUT #3 (of Tutorial3 :) Still CSCB07

  2. Interfaces • Templates for Objects • Interface is a group of related methods with empty bodies • Classes implement interfaces, agreeing to certain predefined behavior • Cannot instantiate an interface(no constructors/variables) • Used for code clarity, OO and defining behavior

  3. Constructors • Create an instance of a class (i.e. an Object) • Platypus p1 = new Platypus(); • NO return type • Same name Class • Differ by input parameters (if more than one) • Purpose to initialize variables and other setup

  4. Encapsulation • Restricts direct access to the internals of your object • Prevents unwanted behavior (users do not know how the class stores its data) • Simplifies usage, OO • Technique of making the fieldsprivateand providing access to the fields via public methods

More Related