Tag:Subclass

  • Object oriented programming (2)

    Time:2021-3-1

    Use__ slots__ Normally, when we define a class and create an instance of class, we can bind any property and method to the instance, which is the flexibility of dynamic language. First define class: class Student(object): pass Then, try to bind a property to the instance: >>> s = Student() >>>S.name =’michael ‘# dynamically bind […]

  • Six inheritance ways to quickly distinguish JS

    Time:2021-2-24

    First, we define a parent class animal, and then use cat class to inherit from this parent class function Animal (name) { this.name = name || ‘Animal’; this.sleep = function(){ console.log ( this.name +’sleeping! ‘); } } Animal.prototype.eat = function(food) { console.log ( this.name +’eating:’ + food ‘); }; 1. Prototype chain inheritance Core: the […]

  • What is the difference between C # interface and abstract class? In what situation do you use interfaces and abstract classes?

    Time:2021-2-23

    The difference between interface and abstract class: Interfaces support multiple inheritance; abstract classes cannot implement multiple inheritance. Interfaces can be used to support callbacks; abstract classes cannot implement callbacks because inheritance does not support them。 Interfaces only contain signatures of methods, properties, indexers and events, but cannot define fields and methods containing implementations; abstract classes […]

  • Learn template mode in five minutes

    Time:2021-2-22

    summary Template pattern is to define an algorithm skeleton in an operation, and then delay some steps to subclasses. Template method enables subclasses to redefine some steps of the algorithm without changing the structure of the algorithm. Usage scenarios Drink tea We all know that the basic steps (algorithm skeleton) of tea making are as […]

  • Learn template mode in five minutes

    Time:2021-2-22

    summary Template pattern is to define an algorithm skeleton in an operation, and then delay some steps to subclasses. Template method enables subclasses to redefine some steps of the algorithm without changing the structure of the algorithm. Usage scenarios Drink tea We all know that the basic steps (algorithm skeleton) of tea making are as […]

  • Basic problems of Java

    Time:2021-2-22

    1、long(8) and float(4)Who is the largest value range? becauselongyes8Bytes,floatyes4It’s a byte. As a rule, we can’t move up. But becausefloatIt is a floating-point type, and its calculation method is different from that of shaping ⅠFirst of alllongCan be automatically converted tofloat; For example: Long number=88888;//88888 Float newNumber=number;//88888.0 Ⅱ、longRange of values indicated:2^63-1 floatRange of values indicated:3.4 […]

  • Django 1.8 official document translation: 6-3 Django exception

    Time:2021-2-18

    Django exception Django throws some of its own exceptions, as well as Python’s standard exceptions. Django core exception Django core exception classes are defined indjango.core.exceptionsIn the middle. ObjectDoesNotExist _exception _ObjectDoesNotExist[source] DoesNotExistThe base class of the exception; rightObjectDoesNotExistOftry/exceptAll models are captured for all modelsDoesNotExistAbnormal. ObjectDoesNotExistandDoesNotExistFor more information onget()。 FieldDoesNotExist _exception _FieldDoesNotExist[source] When the requested field does […]

  • Overview of nsurlsession series of afnetworking source code

    Time:2021-2-17

    1 basic description I remember when I first made IOS, ASI and AFN coexisted at that time, and even the ASI usage ratio was a little more. In a few years, ASI has basically disappeared, and AFN has basically become the standard configuration of IOS projects. Although I have seen the source code of afn2. […]

  • Write a framework with ioc-aop-mvc function from scratch — learning notes — 04. Creation of container and addition, deletion and modification of container members

    Time:2021-2-17

    1. What needs to be done in this section New @ aspect annotation Add classutil # newinstance method to create a real instance object through class object Add the validationutil class as the parameter verification class Write the beancontainer class and its internal method: complete the creation of the container and the operation of adding, […]

  • Django generics view and why it’s so important to see the source code

    Time:2021-2-15

    About reading code We know that, thanks to the language features of python, the source code of Python can be seen directly, and Django is a large and complete thing. Although Django’s documents seem comprehensive, in fact, some modules are not well written, and the requirements are changeable. Sometimes you need to implement some strange […]

  • C # delegate and event implementation observer mode

    Time:2021-2-7

    Demand background Cat barking triggers a series of actions or events. Cat barking causes dogs to bark, children to cry and mom to run. Code structure statement /// ///Interface class /// public interface IObeject { /// ///Provides the method to perform a series of class behaviors inherited from the interface /// void DoAction(); } /// […]

  • NPM upload strategy (Rookie version)

    Time:2021-2-4

    preface By the time of this article’s release – August 13, 2020, the author has just learned how to publish NPM’s own code, and has taken a lot of detours during this period – even though there are many tutorials on the Internet, the specific reasons are omitted here. The original intention of publishing this […]