Solved

Difference Between LET and SET Properties

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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

This is an explanation of a simple data model to help parse a JSON feed
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

777 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