0

Anyone know what association is in C#.

Someone I know is mentioning it and I cannot think what it is.

The only thing I can think of is it being a 'has a' relationship e.g...

class Student : BankAccount
{

}

Even still..this would still be coded in the same way as above?

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by Momerath
0

Sorry, but it would be good to give us more information. From that its impossible to figure out what would you like to have...
but let me try to explain. Your example shows an Inheritance yes.

It means that all the public fields, properties, methods in BankAccount, will be accessable from the Student class as well.
Thats the point of inheritance.

Edited by Mitja Bonca: n/a

0

Your sample code isn't a 'has a', it's a 'is a'. 'Has a' would be

class Student {
    BankAccount ba = new BankAccount();
}

And I believe 'association' means 'has a'.

0

All I am asking is, if you have an 'is a' relationship or a 'has a' relationship, does inheritance cover both of them?

Should you use inheritence for both kinds of relationships?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.