/examples/ioc/CarLibrary4/Car.cs
http://github.com/philiplaureano/LinFu · C# · 46 lines · 39 code · 7 blank · 0 comment · 8 complexity · 1ab8a6631aa280a42c31573fca367618 MD5 · raw file
- using System;
- using System.Collections.Generic;
- using System.Text;
- using CarLibrary3;
- using LinFu.IoC;
- using LinFu.IoC.Configuration;
- using LinFu.IoC.Interfaces;
- namespace CarLibrary3
- {
- public class Car : IVehicle
- {
- private IEngine _engine;
- private IPerson _person;
- public IEngine Engine
- {
- get { return _engine; }
- set { _engine = value; }
- }
- public IPerson Driver
- {
- get { return _person; }
- set { _person = value; }
- }
- public void Move()
- {
- if (_engine == null || _person == null)
- return;
- _engine.Start();
- Console.WriteLine("{0} says: I’m moving!", _person.Name);
- }
- public void Park()
- {
- if (_engine == null || _person == null)
- return;
- _engine.Stop();
- Console.WriteLine("{0} says: I’m parked!", _person.Name);
- }
- }
- }