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?

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.

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'.

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?

Inheritance covers 'is a', it has nothing to do with 'has a'.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.