Skip to content
Snippets Groups Projects

Corrections - Tom

Merged Tom Reclik requested to merge tom into master
1 file
+ 1
1
Compare changes
  • Side-by-side
  • Inline
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
Like this, we have defined a quite generic class class. Since we mainly want to use it for cats and dogs, we assume that we will mostly assign a name to the animals - but we provide a an empty string as default argument so we do not have to name the animal. For example, if we were later to describe a wild bear, we could assign it some specific identifier - but we do not have to.
Like this, we have defined a quite generic class class. Since we mainly want to use it for cats and dogs, we assume that we will mostly assign a name to the animals - but we provide an empty string as default argument so we do not have to name the animal. For example, if we were later to describe a wild bear, we could assign it some specific identifier - but we do not have to.
We have also replaced the function ```bark()``` with a mere generic ```speak()``` as neither cats, nor bears or others bark. However, we notice that we have not implemented anything here. This will depend if we are, for example, to describe cats or dogs. For now, the function does not do anything - it would be better though to raise an error message using methods from exception handling (e.g. raise the ```NotImplementedError```).
We have also replaced the function ```bark()``` with a mere generic ```speak()``` as neither cats, nor bears or others bark. However, we notice that we have not implemented anything here. This will depend if we are, for example, to describe cats or dogs. For now, the function does not do anything - it would be better though to raise an error message using methods from exception handling (e.g. raise the ```NotImplementedError```).
Loading