|
-
Nov 29th, 2000, 05:50 AM
#1
Thread Starter
Fanatic Member
Keddie,
you are right about constructors and destructors but you can get round it to an extent.
Say you have a class CJones
You can write an initialisation procedure, Init, say, to initialise the values in the class. (These would be user set values that cannot be set in the Class_Initialize event)
Code:
Friend Sub Init(Optional Age As Variant, Optional Height As Variant)
If Not IsMissing(Age) Then Me.Age = Age
If Not IsMissing(Height) Then Me.Height = Height
End Sub
Then you write a Public Function in a BAS module to instantiate the class.
Code:
Public Function New_CJones(Optional Age As Variant, Optional Height As Variant)
Set New_CJones = New CJones
New_CJones.Init Age, Height
End Function
Then you ask users to write:
Code:
Dim j As CJones
Set j = New_CJones(10, "1.92 Metres")
You cannot force the user to use the changed code but you can utilise this internally.
I know all that does not answer the question, but I thought you might be interested.
Cheers,
P.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Nov 29th, 2000, 11:19 AM
#2
transcendental analytic
Well thats thats almost the way i use, but i like to put them in the higher level object like directX control has it's Directdrawcreate and methods like blablablacreate or createblabla 
Set DDraw = DirectX.DirectDrawCreate("")
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 29th, 2000, 11:42 AM
#3
Thread Starter
Fanatic Member
Not nearly so tired now...
Haven't been around much so be gentle...
-
Nov 29th, 2000, 01:13 PM
#4
Frenzied Member
Well Guess What. the contstructers for the class are the class its self, on the two drop down boxes in the vb ide, where u select an object and an event ? well goto the .cls file and seelect the class as ur object and initiate or terminate (constructor and deconstructor)
-
Nov 29th, 2000, 01:45 PM
#5
transcendental analytic
Not really the same thing, you can't pass any parameters to them
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 29th, 2000, 01:51 PM
#6
Monday Morning Lunatic
You can't pass parameters to the destructor anyway. For the constructor, just use an Init function. BTW - if VB7 has overloaded functions then they'll be on their way to proper OOP
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Nov 29th, 2000, 02:08 PM
#7
Hyperactive Member
VB7 will have overloading functions, as well as other OOP stuff like inheritance..finally VB will be a proper OOP language (hopefully)
buzzwords are the language of fools
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|