IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
VB Classic
Search VB Classic Group:

Advanced
-Collapse +Expand VB Classic Store

Prestwood eMagazine

March Edition
Subscribe now! It's Free!
Enter your email:

   ► KBProgrammingVB ClassicOOP   Print This     
 
VB Classic OOP:
VB Classic Constructors (Class_Initialize)
 
Posted 14 years ago on 1/18/2009
VB Classic Code Snippet:
 A flashcard from our VB Classic Flashcards Library
 A code snippet from our VB Classic Code Snippets Page

KB101828

General Info: Class Constructor

Constructors are called when you instantiate an object from a class. This is where you can initialize variables and put code you wish executed each time the class is created. When you initially set the member fields and properties of an object, you are initializing the state of the object. The state of an object is the values of all it's member fields and properties at a given time.

Languages Focus: Constructor

What is the syntax? Can you overload constructors? Is a special method name reserved for constructors?

VB Classic Constructors

When an object instance is created from a class, VB6 calls a special parameter-less sub named Class_Initialize. Since you cannot specify parameters for this sub, you also cannot overload it.

When a class is destroyed, VB6 calls a special sub called Class_Terminate.

More Info

Definition:  Class Constructor

Comments

0 Comments.
Share a thought or comment...
 
Write a Comment...
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1257A1
Enter key:
Code Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains play-drums.com and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile


Linked Certification Question(s)

The following are practice certification questions with answers highlighted. These questions were prepared by Mike Prestwood and are intended to stress an important aspect of this KB post. All our practice questions are intended to prepare you generally for passing any certification test as well as prepare you for professional work.

Advanced

1 Advanced Level Question

Question #1: Multiple Choice

In VB Classic object oriented programming, when an object instance is created from a class, VB calls a special parameter-less sub named what?

Answer:
1. 

New

2. 

Class_New

3. 

Initialize

4. 

A method with the same name as the class.

5. 

Class_Initialize


 KB Article #101828 Counter
12680
Since 1/18/2009
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2023 Prestwood IT Solutions.   [Security & Privacy]