当前位置: 首页>>代码示例>>C#>>正文


C# Dog.Bark方法代码示例

本文整理汇总了C#中Dog.Bark方法的典型用法代码示例。如果您正苦于以下问题:C# Dog.Bark方法的具体用法?C# Dog.Bark怎么用?C# Dog.Bark使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dog的用法示例。


在下文中一共展示了Dog.Bark方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

    static void Main(string[] args)
    {
        Dog Pesho = new Dog();
        Dog sharo = new Dog("Sharo","Ovchar");

        sharo.Bark();
    }
开发者ID:AlexanderDimitrov,项目名称:OOP,代码行数:7,代码来源:Program.cs

示例2: Main

    public static void Main()
    {
        Dog sharo = new Dog("Sharo", "bolkonka");
        Dog unnamed = new Dog();
        unnamed.Name = "NewName";

        sharo.Bark();
        unnamed.Bark();
    }
开发者ID:IskraNikolova,项目名称:Object-oriented-programming,代码行数:9,代码来源:ExerciseDefiningClasse.cs

示例3: Main

        public static void Main(string[] args)
        {
            Dog unnamed = new Dog();
            Dog sharo = new Dog("Sharo", "Melez");
            unnamed.Breed = "German Shepherd";

            unnamed.Bark();
            sharo.Bark();
        }
开发者ID:bobosam,项目名称:CSharpOOP,代码行数:9,代码来源:PlayDog.cs

示例4: Main

 static void Main()
 {
     Dog sharo = new Dog("Sharo", "German Shepherd");
     Dog mysteryDog = new Dog();
     Dog lesserDog = new Dog("Lesser Dog", null);
     sharo.Bark();
     mysteryDog.Bark();
     lesserDog.Bark();
 }
开发者ID:krasi070,项目名称:OOP,代码行数:9,代码来源:BarkingDogs.cs

示例5: Main

    static void Main()
    {
        Dog dog = new Dog();
        dog.Name = "Sharo";

        Dog sharo = new Dog("Ivan", "German Shepherd");

        dog.Bark();
        sharo.Bark();
    }
开发者ID:HouseBreaker,项目名称:OOP,代码行数:10,代码来源:DefiningClassesMain.cs

示例6: Main

        public static void Main(string[] args)
        {
            Dog firstDog = new Dog();
            Dog seconDog = new Dog("Bravo", "Husky");

            firstDog.Breed = "Doberman";

            firstDog.Bark();
            seconDog.Bark();
        }
开发者ID:ivailojordanov,项目名称:Fundamental-Level,代码行数:10,代码来源:DefiningClassesExerciseMain.cs

示例7: Main

    static void Main()
    {
        //обекти, инстанции на конкретния клас Dog
        Dog unnamed = new Dog(null, "stray");
        Dog sharo = new Dog("Sharo", "German shepherd");

        //unnamed.Breed = "stray";
        unnamed.Bark();
        sharo.Bark();
    }
开发者ID:VyaraGGeorgieva,项目名称:OOP,代码行数:10,代码来源:Program.cs

示例8: The_dog_does_not_bark_for_0_treats

        public void The_dog_does_not_bark_for_0_treats()
        {
            //Arrange
            var dog = new Dog();

            //Act
            var actualBarks = dog.Bark(0);
            var expectedBarks = new List<string>();

            //Assert
            Assert.IsTrue(actualBarks.Count == expectedBarks.Count, "Dog barked when it wasn't supposed to");
        }
开发者ID:pmgower,项目名称:Week-2-Day-4,代码行数:12,代码来源:When_telling_a_dog_to_bark.cs

示例9: SubclassesCanModifyExistingBehavior

        public void SubclassesCanModifyExistingBehavior()
        {
            var chico = new Chihuahua("Chico");
            Assert.Equal(FILL_ME_IN, chico.Bark());

            //Note that even if we cast the object back to a dog
            //we still get the Chihuahua's behavior. It truly
            //"is-a" Chihuahua
            Dog dog = chico as Dog;
            Assert.Equal(FILL_ME_IN, dog.Bark());

            var fido = new Dog("Fido");
            Assert.Equal(FILL_ME_IN, fido.Bark());
        }
开发者ID:stefanmoser,项目名称:DotNetKoans,代码行数:14,代码来源:AboutInheritance.cs

示例10: Main

        static void Main(string[] args)
        {
            var mimi = new Cat();
            mimi.Owner = "Pehso";
            mimi.Name = "Mimi";

            var stamat = new Dog("Stamat", "Minka");
            stamat.Bark();

            Lion koss = new Lion("Koss", 2, 300);
            koss.Roar();

            Bird sparrow = new Bird();
            sparrow.Sing();
        }
开发者ID:nickgenov,项目名称:ObjectOrientedProgramming,代码行数:15,代码来源:DefineClassesAnimals.cs

示例11: The_dog_does_not_bark_for_0_treats

        public void The_dog_does_not_bark_for_0_treats()
        {
            //Arrange
            var dog = new Dog();

            //Act
            var responses = dog.Bark(0);

            var actualResponse = responses.FirstOrDefault();
            string expectedResponse = null;

            //Assert
            Assert.AreEqual(expectedResponse, actualResponse);
            Assert.IsTrue(responses.Count == 0, "The number of responses from the dog did not equal 0 as expected.");
        }
开发者ID:pmgower,项目名称:Week-2-Day-4,代码行数:15,代码来源:When_telling_a_dog_to_bark.cs

示例12: The_dog_barks_once_for_1_treat

        public void The_dog_barks_once_for_1_treat()
        {
            //Arrange
            var dog = new Dog();

            //Act
            var responses = dog.Bark(1);

            var actualResponse = responses.FirstOrDefault();
            var expectedResponse = "Woof";

            //Assert
            Assert.AreEqual(expectedResponse, actualResponse);
            Assert.IsTrue(responses.Count == 1, "The number of responses from the dog did not equal 1 as expected.");
        }
开发者ID:pmgower,项目名称:Week-2-Day-4,代码行数:15,代码来源:When_telling_a_dog_to_bark.cs

示例13: The_dog_barks_once_for_1_treat

        public void The_dog_barks_once_for_1_treat()
        {
            //Arrange
            var dog = new Dog();

            //Act
            var actualBarks = dog.Bark(1);
            var expectedBarks = new List<string>()
                                {
                                    "Woof"
                                };

            //Assert
            Assert.IsTrue(actualBarks.Count == expectedBarks.Count, "Dog barked when it wasn't supposed to");
        }
开发者ID:pmgower,项目名称:Week-2-Day-4,代码行数:15,代码来源:When_telling_a_dog_to_bark.cs

示例14: SubclassesCanModifyExistingBehavior

        public void SubclassesCanModifyExistingBehavior()
        {
            var chico = new Chihuahua("Chico");
            Assert.Equal("yip", chico.Bark());

            //Note that even if we cast the object back to a dog
            //we still get the Chihuahua's behavior. It truly
            //"is-a" Chihuahua
            /*
            What happens to the original Dog class on this cast? Is it overwritten?
            */
            Dog dog = chico as Dog;
            // Why does chico, now as a dog, yip? It should WOOF! since it's now cast as a Dog.
            Assert.Equal("yip", dog.Bark());

            var fido = new Dog("Fido");
            Assert.Equal("WOOF", fido.Bark());
        }
开发者ID:chiozzo,项目名称:DotNetKoans,代码行数:18,代码来源:AboutInheritance.cs

示例15: Main

 static void Main(string[] args)
 {
     Dog dog = new Dog("pesho", 5);
     dog.Bark();
 }
开发者ID:abaditsegay,项目名称:SVN,代码行数:5,代码来源:Program.cs


注:本文中的Dog.Bark方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。