实体类 class Product { public string Id { get; set; } public string Name { get; set; } public List<ProductDetail> Detail { get; set; } public List<ProductComment> Comment { get; set; } } class ProductDetail { public string DtlId { get; set; } pub
public class People //类名 { private static string name; //字段 private string sex;//字段 public string Sex //属性 { get { return sex; } set { sex = value; } } public static string Name //属性 { get { return People.name; } set { People.name = value; } } } clas
一.三个内置函数 1.issubclass(a, b) 判断a类是否是b类的子类 class Foo: pass class Zi(Foo): pass class Sun(Zi): pass print(issubclass(Zi,Foo)) #True print(issubclass(Zi,Sun)) # False issubclass 2.type(对象) 返回该对象的数据类型,精确识别(即不向上兼容) class Animal: pass class Cat(Animal):
对js中不同数据的布尔值类型总结:false:空字符串:null:undefined:0:NaN.true:除了上面的false的情况其他都为true: 如下: var o = { 'name':'lee' }; var a = ['reg','blue']; function checkBoolean(a){ if(a){ return true; }else{ return false; } } console.log(checkBoolean('')); //false console.l
typeof ,只可判断部分数据的数据类型 数字 字符串 布尔值 undefined function Object.prototype.toString.call() , 通用 function estimateDataType(data) { const type = Object.prototype.toString.call(data) return type.match(/^\[object (\w+)\]$/)[1] } estimateDataType(1) // Number e