美文网首页
class parameter(auto storage) an

class parameter(auto storage) an

作者: cutelittlePanda | 来源:发表于2017-08-15 16:17 被阅读0次

Difference between class parameter and instance parameter:

1. instance parameter is static storage, it's only initialized once no matter how many times invoking, and memory address not change during the whole progress  ; It will not be released untill the program exits.  It works in the area of  instances.

2. class parameter is automatic storage, it's released as soon as after called, and will be initialized not only once; it works only in the class area before instance invoked, such as __init__ instance.

In example codes below, the class parameter 'no_inst' is initialized  every time only if  the class is invoked, and value is always set to be 0; but, the instance parameter 'Kls.no_inst' remains in the memory, it is initialized only once, and the value adds by 1 in every invoking.

class parameter and instance parameter

相关文章

  • class parameter(auto storage) an

    Difference between class parameter and instance parameter...

  • SAP ABAP里数据库表的Storage Parameters

    如何查看ABAP数据库表的storage parameter? 事务码SE11,utilities->Databa...

  • JAVA-BigFileDownloader

    一.bigFileDownloader.class 二.Storage.class 1.NIO的channel I...

  • PyTorch-torch04: Cov2d二维卷积和torch

    torch.nn class torcn.nn.Parameter()Parameters是Variable的子类...

  • 学习随记

    Loading class `com.mysql.jdbc.Driver'. The driver is auto...

  • 小程序 底部 textarea ios 错误完美解决