2015年1月22日星期四

something about this week's lecture.

It has been three weeks from the beginning of semester. I do feel CSC148 is much harder than CSC108. In 108, everything seems so applicable. There are huge amount of practical work example you can learn from, and a lot of practice you may work with (such as the performance part PCRS). In CSC148 everything seems so conceptual, we no longer focus on exactly how to solve the problem, but on the big idea of problem solving.

This week's content is about class and subclass. I know the idea like subclass would inherit properties of classes, and may also alter or override method in parent class. However, when it comes to the tutorial which asks me to write an actual example using class and subclass, I lost myself at all. I think that is because I do not get in touch with some detailed examples.

We all see this in the course:

class A:
   def g(self, n):
      return n
      
   def f(self, n):
      return self.g(n)
      
class B(A):
   def g(self, n):
      return 2 * n

a = A()
b = B()
print("a.f(1): {}".format(a.f(6)))
print("b.f(1): {}".format(b.f(6)))

This example explain the idea of overriding very well, but it is too simple and is hard to apply.

Now I am trying to approach more resource online and learn by myself, but I am really worried about the future of my CSC148... 

没有评论:

发表评论