473,410 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

When to Use a Interface or Inheritance

Good Morning:
I have a simple question I was hoping someone can help me understand. In
Visual Basic.Net when is it best to use an Interface compared to using
Inheritance? For example, if I have a class called PERSON and create other
classes one being EMPLOYEE and another being STUDENT and PERSON holds members
and maybe 1 function that EMPLOYEE and STUDENT uses is it best to use
Inheritance? Better yet, can I use an Interface and Inheritance? Let me know
you opinions and comments are greatly appreciated.
--
TC
Nov 22 '05 #1
3 1148
Search for the recent "Abstract Classes vs Interfaces" thread...

I suggested
http://msdn.microsoft.com/library/de...Interfaces.asp
but you'll find also some more discussions there...

Patrice
---
"Terrance" <Te******@discussions.microsoft.com> a écrit dans le message de
news:D1**********************************@microsof t.com...
Good Morning:
I have a simple question I was hoping someone can help me understand. In
Visual Basic.Net when is it best to use an Interface compared to using
Inheritance? For example, if I have a class called PERSON and create other
classes one being EMPLOYEE and another being STUDENT and PERSON holds members and maybe 1 function that EMPLOYEE and STUDENT uses is it best to use
Inheritance? Better yet, can I use an Interface and Inheritance? Let me know you opinions and comments are greatly appreciated.
--
TC

Nov 22 '05 #2
Hi Terrance

I appriciate ans of the Patrice.In addition to that link, following link is
also useful to clear the concepts.

http://www.churchillobjects.com/c/11003.html

Points to be rember while making the decision of Interface or Abstract Class :

1. We must have to implement all the methods of Interface in the
implementing class.
2. We cannot inherit more the one baseclasses in the single subclass

More tips can be find on specified link.

Bhavesh

"Terrance" wrote:
Good Morning:
I have a simple question I was hoping someone can help me understand. In
Visual Basic.Net when is it best to use an Interface compared to using
Inheritance? For example, if I have a class called PERSON and create other
classes one being EMPLOYEE and another being STUDENT and PERSON holds members
and maybe 1 function that EMPLOYEE and STUDENT uses is it best to use
Inheritance? Better yet, can I use an Interface and Inheritance? Let me know
you opinions and comments are greatly appreciated.
--
TC

Nov 22 '05 #3
Hi Terrance

I appriciate ans of the Patrice.In addition to that link, following link is
also useful to clear the concepts.

http://www.churchillobjects.com/c/11003.html

Points to be rember while making the decision of Interface or Abstract Class :

1. We must have to implement all the methods of Interface in the
implementing class.
2. We cannot inherit more the one baseclasses in the single subclass

More tips can be find on specified link.

Bhavesh

"Terrance" wrote:
Good Morning:
I have a simple question I was hoping someone can help me understand. In
Visual Basic.Net when is it best to use an Interface compared to using
Inheritance? For example, if I have a class called PERSON and create other
classes one being EMPLOYEE and another being STUDENT and PERSON holds members
and maybe 1 function that EMPLOYEE and STUDENT uses is it best to use
Inheritance? Better yet, can I use an Interface and Inheritance? Let me know
you opinions and comments are greatly appreciated.
--
TC

Nov 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Tom Evans | last post by:
My basic question: If I have a specific interface which I know is going to be implemented by a number of classes, but there is no implementation commonality between them, what is the preferred...
20
by: Simon Harvey | last post by:
Festive greetings fellow programmers! I've been programming now for about 4, maybe 5 years now. 4 of those years were at university so and I havent had much work experience of making real world...
3
by: Terrance | last post by:
Good Morning: I have a simple question I was hoping someone can help me understand. In Visual Basic.Net when is it best to use an Interface compared to using Inheritance? For example, if I have a...
2
by: Marius Horak | last post by:
Cannot see any good reason for using it (just duplication of code.). Can you? MH
4
by: christopher diggins | last post by:
A feature that I find signficantly missing in C# is the ability to write functions in interfaces that can call other functions of the interface. Given an interface ISomeInteface the only way we can...
10
by: Brett | last post by:
I'm still trying to figure out concrete reasons to use one over the other. I understand the abstract class can have implementation in its methods and derived classes can only inherit one abstract...
4
by: Raja Chandrasekaran | last post by:
Hai friends, I really wonder, If the interface does not have any definition, Y do we need to use interface. You can then only we can use Multiple inheritance. I really cant understand, Just for...
31
by: damacy | last post by:
hi, there. i have a problem writing a program which can obtain ip addresses of machines running in the same local network. say, there are 4 machines present in the network; , , and and if i...
17
by: Zytan | last post by:
Aren't all classes interfaces? What constitutes an interface (and with it, the "I" prefix distinction)? Zytan
4
by: reon | last post by:
Hi In this program i tried implements,inheritance (I tried multiple inheritance in C++). In C++ I knew that multiple inheritance means we can invoke all classes and class functions from derived...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.