What Is The Difference Between Interface And Abstract Class And Interface And Multiple Inheritance?
1 Answer - Sort by: Date | Rating
An abstract class is a class which you will never instantiate. It is designed as the parent class from which other classes will inherit. It contains a set of common features they will all have. It can contain concrete or abstract methods.
An interface is similar to an abstract class but with one important difference. ALL its methods are abstract. You state the methods that must be used, but do not include the body code for any of them. EG in a geometry program you might have an interface which included an area method, a volume method and a findCentre method. But as the code would be different for every geometrical shape, you leave the body empty. When you use it, you MUST add the code for each empty method.
In some langauges, such as Java, multiple inheritance is not allowed (thankfully, as it is a very complex way to work!). But you can use more than one interface. So it is a sort of way around the lack of multiple inheritance.
An interface is similar to an abstract class but with one important difference. ALL its methods are abstract. You state the methods that must be used, but do not include the body code for any of them. EG in a geometry program you might have an interface which included an area method, a volume method and a findCentre method. But as the code would be different for every geometrical shape, you leave the body empty. When you use it, you MUST add the code for each empty method.
In some langauges, such as Java, multiple inheritance is not allowed (thankfully, as it is a very complex way to work!). But you can use more than one interface. So it is a sort of way around the lack of multiple inheritance.
0
1
- How To Put Digital Camera As A Webcam On Msn?
- How Do I Change The Password For My Webcam?
- Why Isn't Mechanical "Faraday" Power Being Refined & Used For Things Like Toys Where Kids Would Love To Shake Them & We'd Also Greatly Reduce Small Battery Use ?
- Does Webcam Automatic Connect To A Site?
- How To Take Pictures With Built In Webcam On Toshiba Laptop?
- How I Can Use The Windows Movie Maker Since I Can Turn On My Webcam?
- How Can I Get My Webcam Back On My Toshiba?
- How To I Turn On My Webcam On My Gateway Computer?
- How To Hack Someones Webcam?
- Hi,i Am New To Blurtit And Would Like To Know How Do I Set Up My Webcam For My Crea Laptop?
- How Can I Connect My Logitech Game Controller To My Halo C.e. Custom Edition For The Pc?
- Can You Explain How Somebody Would Hold A Hunting Rifle If They Were Sitting Around Waiting For Something To Shoot?
- Why Does My Built In Webcam Not Turn On When My Computer Turns On?
- How To Make A Built In Webcam Connect?
- What Are The Sample Computer Engineering Thesis Title?
- I Have A Notebook Pc/hp Pavilion Dv2-1134 Nr?help Me Learn To Use Webcam I Lost Manual
- Does My Computer Have A Webcam?
- How To Take A Picture With Your Laptop Webcam?
- How To Take A Picture With You Webcam?
- I Lost My Cd To Install My Ez Webcam , What Can I Do?
- I Want A Snowblower With 10 Hp What Is The Equivalent In Foot Pounds?
- How To Convert Pigeon From Links On To My Acer Laptop Webcam?
- How To Connect Built-in Webcam On Acer 5534 To Skype?
- How Do You Get Pictures From Your Webcam Onto Other Websites?
- How Do I Watch Some Ones Webcam?
- Is Multiple Inheritance Possible In Java Language Or Not?
- Why Isn't Multiple Inheritance Used In Java?
- Is Multiple Inheritance Possible In Java Or Not?
- Why In Java Is Multiple Inheritance Is Not Supported?
- Why Does Java Use Interfaces Instead Of Multiple Inheritance?
- Can You Tell Me The Reasons For Not Using Multiple Inheritance In Java?
- W Is It That Hy Java Doesn't Support Multiple Inheritance Directly?
- Is Multiple Inheritance Possible In C#? If It Is Then How?
- How Does Inheritance Help Us To Create A New Class In Java?
- What Is Implementation Inheritance In Java? Please Give An Example Program Also.

New Comment - Comments are editable for 5 min.