Position: 首页> 研发 > 拆解分析

通关流程图文攻略 孤狼第四章怎么打

2023-03-25 07:52:11 SNG

通关流程图文攻略 孤狼第四章怎么打

孤狼lonewolf第4章停车场彻底端掉停车场怎么通关?潜行狙击,神秘暗杀狙击游戏孤狼LONEWOLF现已上架,下面小编就为大家带来孤狼lonewolf第4章第6关停车场完美通关攻略,帮助大家了解?孤狼lonewolf第4章停车场完美通关技巧?,一起来看看吧~ 孤狼lonewolf第4章停车场彻底端掉停车场完美通关攻略 小编提示:本关卡运用的是手枪,注意自己的瞄准精度 一共五个人,是很考验手速的 建议先设计这个车后面的,因为一旦开始设计,他的位置是最难最快射击的 一定要快,千万不能有失误 以上就是小编为大家带来的关于孤狼lonewolf第4章停车场彻底端掉停车场完美通关攻略,希望大家喜欢~

请高手帮我调试下这个工厂方法模式的例子

不得不批评你四点

1.代码严重不规范

   接口和类名的首字母应该而且必须大小

2.不注重界面的美观

   输出应使用WriteLine或者字符串结尾加换行符以达到换行目的 否则输出来乱七八糟的 鬼都看的晕

3.基本的接口常识都很失败

   你所谓的Apple Strawberry  Grape 这些同属于Fruit接口类型的产品居然都没有实现该接口

4.人品太差

   请人帮忙请尊重他人的付出 应该给分 每次都想白拿答案 以后没人愿意帮你的

完整代码:

using System;

using System.Collections.Generic;

using System.Text;

namespace ConsoleApplication1

{

    //fruit.cs

    public interface Fruit

    {

    void grow();

    void harvest();

    void plant();

    }

    //fruitGardener.cs

    public interface FruitGardener

    {

    Fruit Factory();

    }

    //Apple.cs

    public class Apple:Fruit

    {

    public void grow()

    {

    Console.WriteLine(Apple is growing...);

    }

    public void harvest()

    {

    Console.WriteLine(Apple has been harvested.);

    }

    public void plant()

    {

    Console.WriteLine(Apple has been planted.);

    }

    }

    //Grape.cs

    public class Grape : Fruit

    {

    public void grow()

    {

    Console.WriteLine(Grape is growing...);

    }

    public void harvest()

    {

    Console.WriteLine(Grape has been harvested.);

    }

    public void plant()

    {

    Console.WriteLine(Grape has been planted.);

    }

    }

    //Strawberry.cs

    public class Strawberry : Fruit

    {

    public void grow()

    {

    Console.WriteLine(Strawberry is growing...);

    }

    public void harvest()

    {

    Console.WriteLine(Strawberry has been harvested.);

    }

    public void plant()

    {

    Console.WriteLine(Strawberry has been planted.);

    }

    }

    //AppleGardener.cs

    public class AppleGardener : FruitGardener

    {

    public Fruit Factory()

    {

    return new Apple();

    }

    }

    //StrawberryGardener.cs

    public class StrawberryGardener : FruitGardener

    {

    public Fruit Factory()

    {

    return new Strawberry();

    }

    }

    //GrapeGardene.cs

    public class GrapeGardene : FruitGardener

    {

    public Fruit Factory()

    {

    return new Grape();

    }

    }

    //Program.cs

    class Program

    {

    static void getFruit(FruitGardener master)

    {

    Fruit myfruit = master.Factory();

    myfruit.grow();

    myfruit.harvest();

    myfruit.plant();

    }

    static void Main(string[] args)

    {

    getFruit(new AppleGardener());

    getFruit(new GrapeGardene());

    getFruit(new StrawberryGardener());

    Console.ReadLine();

    }

    }

}