They’ve taken the books to Isengard!

--Originally published at Ce qui est chouette

So, here we are again. At it. Java-ing things up. Ain’t that just fun? Welp, it is. It’s so nice outside. So, watched the game? How’re the kids holding up? Are taking your meds? What meds, you ask? Precisely, that’s exactly why you shouldn’t be off ’em, grandpa. Jeez.

On with it, Mr. “I don’t need no heroin in my life” pfft, sissy.

Kenscourses doing some Python importing nowadays with these WSQ’s. The WSQ was received, *(robotVoice)assimilated*, and completed without delay. Really, like, none at all, quite punctual, if you ask me, work ethic worthy of a 100/100, I’d say. Anyways, the deal was to edit a given skeleton to make the class run the main method, for both of the required classes, Book and Library.

Here’s the Book class and its output to console:

They’ve taken the books to Isengard!They’ve taken the books to Isengard!

And here’s the Library class and its output to console:

They’ve taken the books to Isengard!They’ve taken the books to Isengard!They’ve taken the books to Isengard!They’ve taken the books to Isengard!

DONE.

Talking LOTR,

They’ve taken the books to Isengard!
flickr “The Lord of the Ring country” by CameliaTWU under a CC License.

Beautifully closing,

-The about guy.

 


They’ve taken the books to Isengard!

Masterie ”has-a” and “is-a” .

--Originally published at Alan TC201

One of cool thing you can do in Object-Oriented programming language is to reuse a code. There are two ways we can do code reuse, by implementation of inheritance or object composition. But you need to be careful how and what method you will use depending if it IS-A relationship or HAS-A relationship.

Masterie ”has-a” and “is-a” .

This image is very clear, but if you still can get the concept I will explain using the same example. You have a class with specifications about cars, like they uses some type of combustible, they move, and have doors, then you have a class name Maruti (a type of car) well that class is a relationship between the class car, everything inside the class car is valid for the class maruti.

Masterie ”has-a” and “is-a” .
On the other hand we have another class name engine, the maruti class HAS a relationship with the class engine because there are many types of engine but the maruti only cares about its engine, at the same time the engine has a relationship with the murati because that car needs an engine but the engine class does not care about the doors or of the car moves.

Masterie ”has-a” and “is-a” .

Down here are more specifications if you still are having trouble getting this.

IS-A relationship

  • This refers to inheritance or implementation.
  • Expressed using keyword “extends”.
  • Main advantage is code reusability.

In object oriented programming, the concept of IS-A is a totally based on Inheritance, which can be of two types Class Inheritance or Interface Inheritance. It is just like saying “A is a B type of thing”. For example, Apple is a Fruit, Car is a Vehicle etc. Inheritance is uni-directional. For example House is a Building. But Building is not a House.

It is key point to note that you can easily identify the IS-A relationship. Wherever you see an extends keyword or implements keyword in a class declaration, then this class is said to have IS-A relationship.

HAS-A relationship
Composition(HAS-A) simply mean use of instance variables that are references to other objects. For example: Maruti has Engine, or House has Bathroom.

  • Has-A means an instance of one class “has a” reference to an instance of another class or another instance of same class.
  • It is also known as “composition” or “aggregation”.
  • There is no specific keyword to implement HAS-A relationship but mostly we are depended upon “new” keyword.

More info (http://learnwithharsha.com/my-first-java-lesson-is-a-and-has-a-relationships/)

And a video that explains everything with details.


Masterie ”has-a” and “is-a” .

He-he, POO, he-he

--Originally published at Ce qui est chouette

Watched, the video lies. Learn, I have.

Inheritance sounds cool and quite useful, is-a and has-a relations were easy to grasp. Example: Coffee has caffeine [has-a], coffee is a beverage [is-a] (shoutout to codecademy’s course on Java, which I’ve finished).

That’s about all I have to say about that, here are some pics of a test program I wrote using inheritance -in classic OOP manner, he-he POO. David Bowie (Major Tom) is-a singer ;) gotcha.

He-he, POO, he-he
I know I’m a little late on the Bowie train.
He-he, POO, he-he
But I ain’t going off the rails #ozzy

The jokes are insane, as we lie aboard a crazy train.

-Lil’ about guy.


He-he, POO, he-he

He-he, POO, he-he

--Originally published at Ce qui est chouette

Watched, the video lies. Learn, I have.

Inheritance sounds cool and quite useful, is-a and has-a relations were easy to grasp. Example: Coffee has caffeine [has-a], coffee is a beverage [is-a] (shoutout to codecademy’s course on Java, which I’ve finished).

That’s about all I have to say about that, here are some pics of a test program I wrote using inheritance -in classic OOP manner, he-he POO. David Bowie (Major Tom) is-a singer ;) gotcha.

He-he, POO, he-he
I know I’m a little late on the Bowie train.
He-he, POO, he-he
But I ain’t going off the rails #ozzy

The jokes are insane, as we lie aboard a crazy train.

-Lil’ about guy.


He-he, POO, he-he