2015年2月9日星期一

Week 4: Impression of first few weeks

  It has already one moth passed from we start learning csc148.
  During the first four weeks, we catched many important and interesting method of O-O design.
 
  First, the special method:
    __init__ which construct an instance for the class
    __str__ which return a string decribing the instance
    __repr__ which also return a string but construct an object with same value
    __eq__ which compare two instance with ==
  They are fresh to me and gradually let me know how these methods and classes work.

  Then the proprty mechanism for a class and see how it works.

  We also talk about ADT( Abstract Data Types). We define data and operations on it so that we can generalized complex problems into categories. And to deal with these "different" problems we can easily find similar method to slove them.

   The stack contains various of sorts. New items are pushed into stack and old items are popped from the stack. But it is carefully for us to check whether it is empty before we removed iterm!

  We talked inheritance in the following week. Professor use company-employee-hourly/salary employee examples for us to show how a child class can inhert from its parent class and add new methods which the "shared" parent didn't have.
  These were fabulous! Due to parent classes, we can creat a class more simplely and precisely and easily to give them new features.

没有评论:

发表评论