Jump to content

lynnt

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by lynnt

  1. Good morning - I have a question about UML Diagrams.

     

    Let's assume that we have a class called Step. One of Step's properties is stepNo.

     

    In a UML Class Diagram, we could use the following to indicate the types that stepNo's getter and setter methods are expected to return.

     

    +getStepNo:String

    +setStepNo:void

     

    In a UML Class Diagram, we could use the following to indicate the types that stepNo's getter and setter methods expect to receive as input parameters.

     

    +getStepNo()

    +setStepNo(stepNo:String)

     

    For each method, how would we indicate both? In other words, how do we represent both the parameters a method expects to receive and those it expects to return?

     

    Thank you.

  2. I was experimenting with the access modifiers in Step 17 of Object Oriented PHP for Beginners. I made pinn_number a private property. I used the classes' constructor to set its value. Finally, I created a public function called get_pinn_number().

     

    Outside of the class, I was able to obtain the value of pinn_number using get_pinn_number. I do not understand why this would work. I understand that the value of making properties private is so that their values are available only within the class where they are defined. Therefore, in practice, why would a developer make the value of a private property available through a public function? In practice, would a developer make get_pinn_number() a private function - and not a public one? This documentation is awesome! Thanks so much!

×
×
  • Create New...