码迷,mamicode.com
首页 >  
搜索关键字:eat    ( 649个结果
c++ 继承多个类
#include using namespace std;class BaseA {public: void say() { cout << "hello world" << endl; }};class BaseB {public: void eat() { ...
分类:编程语言   时间:2015-06-18 21:54:27    阅读次数:175
[Swust 549]--变位词(vector水过)
Time limit(ms): 1000 Memory limit(kb): 65535Description输入N和一个要查找的字符串,以下有N个字符串,我们需要找出其中的所有待查找字符串的变位词(例如eat,eta,aet就是变位词)按字典序列输出,并且输出总数目Input第一行:...
分类:其他好文   时间:2015-06-16 14:23:04    阅读次数:88
深入了解java的一维数组
publicclassArrayTest{ publicstaticvoidmain(String[]args) { Animal[]a=newAnimal[3]; Dogd1=newDog(); Dogd2=newDog(); Catc1=newCat(); Catc2=newCat(); a[0]=d1; a[1]=d2; a[2]=c1; a[3]=c2; //需求:遍历数组,取出每一个对象,如果是Dog,执行eat方法,如果是Cat,执行m..
分类:编程语言   时间:2015-06-14 16:53:40    阅读次数:148
C++ 纯虚方法
1、纯虚方法解决什么样的问题,为什么要设计出纯虚方法? 考虑下面的需求,基类声明了一个方法,这个方法只针对具体的子类才有意义,比如Animal的Eat()方法,调用Animal的Eat方法是没有意义的。比如Dog吃肉,Cat吃鱼,而Animal吃什么呢,没有意义。2、既然Animal调用Eat没有意...
分类:编程语言   时间:2015-06-12 23:38:38    阅读次数:190
javascript的面向对象用法
Javascript的面向对象使用方法简单介绍如下: //声明构造Person类。使用function作为构造方法。functionPerson(){ }//Person类的公共属性。使用.prototype声明。 Person.prototype={ name:"张三", age:22, gender:"男", eat:function(s){ alert("我吃:"+s); }..
分类:编程语言   时间:2015-06-09 14:13:38    阅读次数:153
javascript面向对象用法
functionPerson(){//构造方法 } Person.prototype={ name:"张三", age:22, gender:"男", eat:function(s){ alert("我吃:"+s); } }; varp=newPerson(); functionUser(pwd){ varpasswd=pwd;//私有 functiongetPwd(){//私有 returnpasswd; } this...
分类:编程语言   时间:2015-06-09 06:18:46    阅读次数:108
转!! 工厂方法--反射机制
简单工厂模式:interface fruit{ public abstract void eat();} class Apple implements fruit{ public void eat(){ System.out.println("Apple"); }} ...
分类:其他好文   时间:2015-06-06 17:55:43    阅读次数:114
工厂模式与反射
工厂模式与反射定义一个接口以及两个实现了该接口的类:package Reflect;interface fruit{ public void eat();}class Apple implements fruit{ public void eat(){ System.ou...
分类:其他好文   时间:2015-05-26 23:22:02    阅读次数:178
JAVA 创建类,使用类
一、创建类:Test.java//定义类public class Test{ //属性 String name; String gender; int age; //方法,无参无返回 public void eat(){ System.out...
分类:编程语言   时间:2015-05-24 23:09:30    阅读次数:195
5.0OC基础语法-继承、多态
继承继承的基本用法设计两个类Bird、Dog// Bird的声明@interface Bird : NSObject{ @public int weight;}- (void)eat;@end// Bird的定义@implementation Bird- (void)eat { N...
分类:其他好文   时间:2015-05-23 18:22:05    阅读次数:146
649条   上一页 1 ... 52 53 54 55 56 ... 65 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!