In this article we will just be sure to know how to implement dating inside the c-sharp playing with object situated standards eg genetics, association, aggregation and you can structure that have a simple example and you will factor having fun with c-evident.
Most of these matchmaking is dependent on “are a great” dating, “has-a” matchmaking and “part-of” relationships. So i’d like to determine you this one because of the you to.
Genetics predicated on Was-A love
Heredity within the C# was a pops-boy matchmaking in which i manage a new classification that with present category code (we.elizabeth. reusing actions, features or any other details). Genetics allows us to reuse of code once more once more setting parent class are followed to your amount of child categories. Inheritance spends special reputation called “:” anus to make a love.
Inside over analogy all of our mother is an effective PQRCompany. SalesManager are an employee work into the PQRCompany and you can SalesTeam work on the PQRCompany.So there was a pops-man dating anywhere between PQRCompany-SalesManager and you may PQRCompany-SalesTeam, since SalesManager and you will SalesTeam functions around same team. Today let lay so it about programming design.
Rather than having fun with a family label as a father you could potentially additionally use “employee” given that a daddy class once the SalesManager and you will SalesTeam are each other staff only.But it is optional it does changes according to circumstance if you prefer you can keep “Company” since the a grandfather otherwise “Employee” because the a parent. Making this the way we need incorporate father or mother-boy dating within our password with regards to the circumstances.
Connection lies in Has-A relationship
Relationship is based on “has-a” relationships concept. Allow me to establish the definition hookup near me Sarnia playing with a straightforward example. Continue reading “Know Relationship, Structure, Aggregation and you will Inheritance within the C#”