Sunteți pe pagina 1din 1

A Pointer must have a memory address to be called pointer.

Handle is more general term and it doesn't have to hold memory address but any
integer value that kernel can understand.
So a handle can store a 1234545 which is not memory address but kernel uses that
number to identify a file in a table maybe.
But Handle can also store memory address and can be used as Pointer.

A handle is like a reference which points a resource.


It can point at a memory address like a Pointer but Handle is more general term so
it is more like a pseudo-pointer.
A file is a good example for this. A file can have an ID which OS can understand
and use to find the file.
So Handle can hold this ID (which may or may not be a Memory Address) and when we
pass this Handle in, OS can find the file easily.

EXAMPLE FOR HANDLE:

A class is a type that includes data and subroutines (functions and tasks) that
operate on that data.
A classs data is referred to as class properties, and its subroutines are called
methods, both are members of the class.

A class defines a data type.


An object is an instance of that class.
An object is used by first declaring a variable of that class type (that holds an
object handle) and
then creating an object of that class (using the new function) and assigning it to
the variable.

Classes allow objects to be dynamically created, deleted, assigned, and accessed


via object handles.

class Packet;
//

Here Packet is a class

//
endclass

Packet p; // declare a variable of class Packet


p = new; // initialize variable to a new allocated object of the class Packet

The variable p is said to hold an object handle to an object of class Packet.


Uninitialized object handles are set by default to the special value null.
An uninitialized object can be detected by comparing its handle with null.

SystemVerilog objects are referenced using an object handle.

S-ar putea să vă placă și