#! /usr/bin/python # -*- coding: utf-8 -*- # # # “Recently I had a visit with my mom and we realized that the two digits that # make up my age when reversed resulted in her age. For example, if she’s 73, # I’m 37. We wondered how often this has happe…
Lua本身是没有class之类的关键字的,但是我们可以巧妙利用function也是值和table的特性来实现面向对象的特性. 通过复制表的实现 Lua中的类也是一个table对象,下面我们看看一个简单的类的定义: People = {}--定义表 People --添加方法的第一种方式 People.talk = function() print("people talk.") end --添加方法的第二种方式 function People.say() print("peo…
静态内部抽象类可以被继承. public class testfather { public static void main(String[] args) { person.talk2 a = new newtalk(); a.get(); person person1 = new student("alice", 20, "女"); System.out.println(person1.talk()); /* person person2 = new perso…
package test1;//多态的体现import javax.print.attribute.standard.RequestingUserName;import java.util.Scanner;public class testfather {public static void main(String[] args){ Animal a = new fish(); //父类对象被赋以子类类型 /*Animal a; fish b = new fish b; a= b; /…
一多线程的概念介绍 threading模块介绍 threading模块和multiprocessing模块在使用层面,有很大的相似性. 二.开启多线程的两种方式 1.创建线程的开销比创建进程的开销小,因而创建线程的速度快 from multiprocessing import Process from threading import Thread import os import time def work(): print('<%s> is running'%os.getpid()) ti…