TutorMe homepage
Subjects
PRICING
COURSES
SIGN IN
Start Free Trial
Udbhav S.
Developer
Tutor Satisfaction Guarantee
MATLAB
TutorMe
Question:

Do a basic matrix multiplication

Udbhav S.
Answer:

A = [1 1 0 0]; B = [1; 2; 3; 4]; C = A*B C = 3

Java Programming
TutorMe
Question:

What is the difference between Inheritance and Polymorphism?

Udbhav S.
Answer:

Polymorphism: Suppose you work for a company that sells pens. So you make a very nice class called "Pen" that handles everything that you need to know about a pen. You write all sorts of classes for billing, shipping, creating invoices, all using the Pen class. A day boss comes and says, "Great news! The company is growing and we are selling Books & CD's now!" Not great news because now you have to change every class that uses Pen to also use Book & CD. But what if you had originally created an interface called "SellableProduct", and Pen implemented this interface. Then you could have written all your shipping, invoicing, etc classes to use that interface instead of Pen. Now all you would have to do is create a new class called Book & CompactDisc which implements the SellableProduct interface. Because of polymorphism, all of the other classes could continue to work without change! Make Sense? So, it means using Inheritance which is one of the way to achieve polymorphism. Polymorphism can be possible in a class / interface but Inheritance always between 2 OR more classes / interfaces. Inheritance always conform "is-a" relationship whereas it is not always with Polymorphism (which can conform both "is-a" / "has-a" relationship.

C Programming
TutorMe
Question:

What is the response for the following in Java and in C? int a = 3; int b = a; a = 5; b = ?

Udbhav S.
Answer:

In C, b would have the value of 3. However, in Java, this same value would be 5. This is because Java uses reference pointers.

Send a message explaining your
needs and Udbhav will reply soon.
Contact Udbhav
Ready now? Request a lesson.
Start Session
FAQs
What is a lesson?
A lesson is virtual lesson space on our platform where you and a tutor can communicate. You'll have the option to communicate using video/audio as well as text chat. You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.
How do I begin a lesson?
If the tutor is currently online, you can click the "Start Session" button above. If they are offline, you can always send them a message to schedule a lesson.
Who are TutorMe tutors?
Many of our tutors are current college students or recent graduates of top-tier universities like MIT, Harvard and USC. TutorMe has thousands of top-quality tutors available to work with you.