Click here to Skip to main content
15,894,405 members
Articles / Programming Languages / C#

Implementation of Type of Association

Rate me:
Please Sign up or sign in to vote.
4.67/5 (2 votes)
24 May 2013CPOL2 min read 24.4K   196   5  
Unidirectional, Bidirectional, Aggregation and Composition implementation
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Aggregation
{
    class Program
    {
        static void Main(string[] args)
        {
        }
    }

    public class BiologyDempartment
    {
        private IList<Teacher> teachers;

        public BiologyDempartment(IList<Teacher> teachers)
        {
            this.teachers = teachers;
        }

    }

    public class Teacher
    {
        string teacherName;
        public Teacher(string teacherName)
        {
            this.teacherName = teacherName;
        }

    }

    public class Car
    {
        private Wheel wheel;
        private Engine engine;

        public Car(Wheel wheel,Engine engine)
        {
            this.wheel = wheel;
            this.engine = engine;
        }
    }

    public class Wheel
    { 
    }

    public class Engine
    { 
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer Lionbridge
India India
Amey K Bhatkar, a “Microsoft .Net” Web Developer.
I am programmer by will and profession.
I have completed my MCA in 2011 and join software industry.
Presently I am working with Lion Bridge Technologies in Mumbai - India

Comments and Discussions