一、 继承 1. 继承的基本用法 l 设计两个类Bird、Dog // Bird的声明 @interface Bird : NSObject { @public int weight; } - (void)eat; @end // Bird的定义 @implementation Bird - (vo...
分类:
其他好文 时间:
2015-05-19 18:31:15
阅读次数:
198
as用法归纳1. 用作介词,意为“作为”、“当作”、“充当”。如:He treats me as a child. 他把我当小孩看待。As your doctor, I advise you to eat less. 作为你的医生,我建议你少吃点。2. 用作连词,注意以下用法:(1) 表示“随着”。...
分类:
其他好文 时间:
2015-05-18 15:58:36
阅读次数:
153
//纯虚函数的简单应用。
#include
using namespace std;
class A
{
public:
virtual void Eat() = 0;
virtual void Sleep() = 0;
virtual void Foot() = 0;
};
class P : public A
{
public:
void Eat()
{
cout<<"P::E...
分类:
编程语言 时间:
2015-05-15 09:12:47
阅读次数:
142
#includeusing namespace std;class Animal { public: Animal(){} Animal(int weight, int height){} void eat(){ cout breath()调用的确是父类的breath*/Animal *An=new...
分类:
其他好文 时间:
2015-05-14 20:12:34
阅读次数:
106
继承,同样不是真正严格意义上面向对象的继承,而是通过javascript中的原型链关系实现函数之间的属性,方法共享.下面简单分享几种封装的方法.既然说到继承,我们必须有一个基类123456789functionPerson(){this.eat=function(){return'吃食物';}}Pe...
分类:
编程语言 时间:
2015-05-12 20:28:19
阅读次数:
164
javascriptoop编程—实现继承的三种形式[1](1)模拟类的方式,我们都知道js是原型继承机制,不存在class和instance分离的这种方式假设,我们有两个类functionAnimal(){ this.name=“animal”; this.eat=function(){ consle.log(“eating"); }}functionCat(){ this.say=functi..
分类:
编程语言 时间:
2015-05-09 06:39:56
阅读次数:
307
package com_package1;public class Dog extends Animal{ public void eat() { System.out.println("啃骨头"); }//将父类中的抽象方法实例化 pu...
分类:
其他好文 时间:
2015-05-06 22:51:22
阅读次数:
165
abstract class Animal{ int legs; public Animal(int legs){ this.legs=legs; } public Animal(){} public abstract void eat(...
分类:
编程语言 时间:
2015-05-03 20:30:57
阅读次数:
146
Problem Description
In the mysterious forest, there is a group of Magi. Most of them like to eat human beings, so they are called “The Ogre Magi”, but there is an special one whose favorite food is ha...
分类:
其他好文 时间:
2015-04-28 14:08:31
阅读次数:
129
同一个包myjava中:
主程序myjava.java类文件
package myjava;
import myjava.*;
public class myjava implements Jinterface {
public void eat(){
System.out.println("Mammal eats");
...
分类:
编程语言 时间:
2015-04-26 12:26:16
阅读次数:
122