Object-oriented programming is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields, and the code is in the form of procedures. A common feature of objects is that procedures are attached to them and can access and modify the object's data fields.
Four Principles of Object-Oriented Programming:
- This is a way of expanding an already existing class and extending its properties as well.
- Its a method of representing an entity without showing the implmentation details.
- Its a way of implementing the same object or methd in multiple forms for different purposes.
- This is a way of hiding information from being accessible by some classes. Its a way of making private methods.
Method 1:
- run the replit link and see the result : Replit Link
Method 2:
- Clone the repo
oop-classify-the-animal-kingdom
. - To run the solution, make sure you have nodejs installed.
- Use the following command in your terminal.
node object-oriented.js
- You can explore the code however suits you
--> oop-classify-animal-kingdom> node object-oriented.js
CLASSIFICATION OF THE ANIMAL KINGDOM
Bird
Aves {
animalName: 'Bird',
classification: 'Aves',
withBackbone: true,
warmBlooded: true
}
Cat
Mammal {
animalName: 'Cat',
classification: 'Mammal',
withBackbone: true,
warmBlooded: true
}
Butterfly
Arthropoda {
animalName: 'Butterfly',
classification: 'Arthropoda',
withoutBackbone: true,
coldBlooded: true
}
Tilapia
Fish {
animalName: 'Tilapia',
classification: 'Fish',
withBackbone: true,
coldBlooded: true
}
Toad
Amphibia {
animalName: 'Toad',
classification: 'Amphibia',
withBackbone: true,
coldBlooded: true
}
Turtle
Reptiles {
animalName: 'Turtle',
classification: 'Reptiles',
withBackbone: true,
coldBlooded: true
}