Solved

Difference Between LET and SET Properties

Posted on 2004-03-20
4
535 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This is an explanation of a simple data model to help parse a JSON feed
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.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

757 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now