Solved

Difference Between LET and SET Properties

Posted on 2004-03-20
4
570 Views
Last Modified: 2012-05-04
Set properties can take object as parameter value.But Let can also take variant which can accept object.So what is differnce in LET and SET
0
Comment
Question by:sanjusambhe
  • 2
4 Comments
 
LVL 22

Expert Comment

by:cookre
ID: 10643141
0
 
LVL 1

Accepted Solution

by:
SubodhKatiyar earned 250 total points
ID: 10657043
let properties are used for changing non object variable types inside class
for example say you have a class with property color which stores the value of color in some local m_var as a long inside class you can use let.
public propery let color(somecolor as long)
m_color=somecolor 'notice this property can only take basic var types
end property
but if you have a connection object inside your class defined as
dim mconn as adodb.connection '(not new connection)
and you want the users of this class to provide their own connection to your class so that you use existing connection of the clients,you will use the set property which is optimized for accepting objects as parameter.
inside the code block for the set property you would do this.
public property set setconn(someconn as adodb.connection)
set  m_conn=someconn 'you just received a object pointer and set it to your obect pheww.
end property

hope it is clear now.
set properties are great i use them extensively for reusing connection objects.

take care
0
 
LVL 1

Expert Comment

by:SubodhKatiyar
ID: 10657069
and using variants is an expensive operation you are passing in vt the type of object you want to use and it is dereferenced from there,why would some one pass a pointer inside a variant which would then be reread and vb will find the type o object it has and later on every processing is done using the same route of reading discovering and executing,where as you have one direct way of doing the same.
its like there is if then endif and iif also
different purpose different things.
regards.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question