?
Solved

Difference Between LET and SET Properties

Posted on 2004-03-20
4
Medium Priority
?
597 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 22

Expert Comment

by:cookre
ID: 10643141
0
 
LVL 1

Accepted Solution

by:
SubodhKatiyar earned 500 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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This is about my first experience with programming Arduino.
Six Sigma Control Plans
Starting up a Project

762 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