oop Flashcards

1
Q

inheritance

A
  • subclass inherits public attributes and methods from superclass
  • can override & extend these public methods wo the need to re-implement these methods in their own classes
  • to promote code reuse
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

encapsulation

A
  • bundling of data and methods that act on the data into an object
  • prevents inadvertent modification of data by separating the interface of object from its implementation (purpose)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

polymorphism

A
  • polymorphic classes present the same interface & have a common set of methods which have the same name but exhibit different behaviours at runtime
  • to promote code generalisation
    so that instances of polymorphic classes can be handled with the same code without needing conditional handling
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

advantage of encapsulation

A
  • thru keeping public mtds & attributes private, keeps data structure more consistent
  • prevent bugs (caused frm syntax errors)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

advantage of inheritance

A

less likelihood of bugs when modifying code (bc less code duplication)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

KW for polymorphism

A

behave differently

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

how encapsulation achieves data&info hiding in the design

A
  • encapsulation invl restricting access to private attributes using public methods
  • thus separating the interface of an object from its implementation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly