generated from nus-cs2030/base-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Lecture 2 Summary
Russell Saerang edited this page Sep 9, 2021
·
2 revisions
- is-a relationship
- The use of
super(...)
to access the parent's constructor -
super.method()
orsuper.attribute
to access the parent's method and attribute accordingly - Example Code
class Parent {
Parent(...) { ... }
void foo(...) { ... }
// some other methods
}
class Child extends Parent {
Child(...) {
super(...) // Must be the first statement of the constructor if needed
// somethingelse()?
}
}
Think of it as treating something like your private bedroom where only you can get in VS your family room where... your whole family can access!
- Overriding: explicitly defining a method that is the same as the method inherited from another class
- Overloading: having more than one methods to co-exists as long as the arguments are different in configuration
Peer Learning
Guides
Setting Up Checkstyle
Setting Up Java
Setting Up MacVim
Setting Up Stu
Setting Up Unix For Mac
Setting Up Unix For Windows
Setting Up Vim
Setting up SSH Config
SSH Without Password
Copying Files From PE Nodes
Using tmux
CS2030 Contents
Lecture 1 SummaryLecture 2 Summary
Access Modifiers
Lecture 3 Summary (Polymorphism)
Compile Time Type VS Runtime Type
Abstraction, Encapsulation, Inheritance, and Polymorphism
SOLID Principles
Class VS Abstract Class VS Interface
Comparable VS Comparator
Generic Types T
HashMap
Raw Types with Generic
Lambda expression
PECS (Producer Extends Consumer Super)
Optional
Streams
Parallel Streams
Monad
Functors and Monads with Category Theory