|
I do have a reasonable knowledge of OOP concepts and can understand why to put the enums into their
respective classes, however i am a bit confused over the mention of polymorphism. I have read the link on Wiki.
Can you elaborate further why i need to undertand polymorphism in this case for moving the enums into their own classes?
Thanks
|
|
|
|
|
Hi,
Polymorphism is a concept in OOP where the same methods, properties etc can exist accross different objects and in essence behave differently.
For instance two classes called Aircraft and F1Car may have a method called Increase Throttle. The method for aircraft would increase the flow of air over the wings and cause lift whereas on the F1Car increasing the throttle would in effect cause the opposite to lift.
So you can have a method called Increase Throttle that exists across multiple objects and which has a different behaviour.
When it comes to programming you could even inherit the Aircraft methods, if you really wanted to, for the F1Car and override Increase Throttle to make it decrease lift.
The beauty of this is that, for instance with enums, you can declare the same methods or properties across multiple classes and they will behave accordingly - so no need to declare them once only and if you need a similar method for another class create something with a slightly different name (which is what you have do do in the area of procedural programming).
I hope this explains why understanding polymorphism helps.
Regards
Guy
You always pass failure on the way to success.
|
|
|
|
|
I understand Polymorphism better than before because of your explanation, thanks.
I am still confused how this applies to my Enums though.
Do you have an exact example of how this would apply using enums?
Thanks
Ps:-
To be honest what i was trying to do in the first place was probably bad practise, trying to put enums all in one place. I think as mentioned by someone ealrier they should be contained in each class.
|
|
|
|
|
Lets say you have an enum called SpeedWarning that applies to Aircraft and F1:
The Aircraft enums may be as follows
SpeedWarning:
TooSlowStall = 120
TooFastManeuver = 350
Whereas the F1 car may have
SpeedWarning:
TooFastDryCorner = 150
TooFastWetCorner = 80
So both Aircraft and F1 car have SpeedWarning as an Enum however they both have different contents and values.
So in this case you basically want to represent different applications of the enum SpeedWarning depending on the class they are associated with(Aircraft or F1).
If SpeedWarning was defined as an enum in one place you would lose the polymorphism properties of OOP as you would have to create something akin to SpeedWarningAircraft and SpeedWarningF1 enums.
Regards
Guy
You always pass failure on the way to success.
|
|
|
|
|
Guy,
Thanks alot - just needed a good example - could'nt see the Forest because the trees were in the way!!
Thanks
|
|
|
|
|
No probs,
I'm glad it helps .
Regards
Guy
You always pass failure on the way to success.
|
|
|
|
|
hi i am making a project based on attendance report i want get the fingerprint in the textbox and store it in the database in another format
|
|
|
|
|
What do you mean by "fingerprint"?? Is it the user's actualy fingerprint or some employee id number?? And how does this "fingerprint" relate to a TextBox? The name of that control should tell you something about how it works.
|
|
|
|
|
Yet another person plans their project without any research...
If you have a fingerprint reader, it may have an SDK you can use. If you don't, you don't have any way of getting a fingerprint, right ?
A fingerprint will obviously be a bitmap. I suspect that a fingerprint reader will store other data about a fingerprint, for the purpose of comparison.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi i am doing a project on personal manager i want to make the project as trial version(not work more than 3or4 days)
advance thanks help me please!!!
|
|
|
|
|
There are commercial tools available for this kind of tasks. But you can consider making something quick and dirty for yourself.
Store the date of first run somewhere (eg registry), best in an encrypted way. And every time open or access your application (event activated) you check the date and evaluate.
|
|
|
|
|
Hello,
VS 2005.
I am creating some software and don't want the software to be installed on any other computers.
I can give it to the customer, but how can I avoid the customer from installing it on other computers.
I think I need to create some license so that the setup I give them will not be able to install if it has already been installed on another computer.
Which is the best practice when it comes to distributing software and to avoid the customer from installing on many computers?
Many thanks for any advice,
Steve
|
|
|
|
|
steve_rm wrote: I can give it to the customer, but how can I avoid the customer from installing it on other computers.
Simple. You can't. It's impossible for you to stop the installation on another machine.
steve_rm wrote: I think I need to create some license so that the setup I give them will not be able to install if it has already been installed on another computer.
Now, how is the other computer going to know that?
steve_rm wrote: Which is the best practice when it comes to distributing software and to avoid the customer from installing on many computers?
There isn't one.
|
|
|
|
|
I hate to disagree here, but it can be done, Windows does it now. It just involves a central server that tracks which keys have been used, and on what machines. 'Just' is an understatement, it's a fair bit of work and an inconvenience to end users.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: I hate to disagree here, but it can be done, Windows does it now.
Oh I know that. In order for this to work, the machines all have to have access acrossed a network to some central license server.
But in the case of disconnected PC's, it's impossible to do.
Christian Graus wrote: 'Just' is an understatement, it's a fair bit of work and an inconvenience to end users.
Not to mention beyond the abilities of way too many "developers"!
|
|
|
|
|
hi steve_rm
i think the solution for is to get a third party software that will do that for you, http://application-licensing.qarchive.org/[^].Next thing you should do is to learn Encription. how it works. your question is vast. try to google about encryption or get some e-books on that.
hope it helps
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
What I have done is to create a EULA by copying another EULA that is close enough to what I want and then modify it.
In terms of the law, from what I understand, if your EULA is written in good logical English that should do.
It does not need to be written in legalese in order to sue the hell out of whoever re-distributes your software - ooh I'll just calm down for a minute.
I also create trial versions that stamp the registry with an encrypted date so that the software stops working when the date passes.
To activate the software the user needs to buy the activation key from me - which is basically whatever keys my pet gerbils walk over on my keyboard (my best randomization routine yet!).
My take on it is that if the user is brainy enough to crack the registry location and break the code - they can have the software.
Also another good idea - in the trial version have certain aspects disabled which can only be enabled with the registration key - this will get your users hungry for more.
If they decide to sell the registration key themselves then I guess you could sue them.
You always pass failure on the way to success.
|
|
|
|
|
The way to do this, is to create a machine level key which is used to build a response key. Like windows does. Then, you store an online database of those keys that have been used, so they cannot be used again.
So, the key is unique to a PC, and it ties in with a akey they have to enter. Then your central method works out what the key was, marks it as used, and returns the correct response.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I need to be able to print ID cards with magnetic stripes from a VB.NET application. Encoding the mag stripe is a simple matter of putting special code characters in the text to print. I can print text to the card printer from Notepad, ConText or any other text editor, and the printer knows to encode the stripe. This even works printing from a report in Access, but not from a Crystal report, and not from the .NET PrintDocument object. All these do is print the information to be encoded on the front of the card.
So anyway, I need to print simple text from a .NET app without using .NET printing objects or Crystal.
|
|
|
|
|
|
Thanks, but since the printer is not a POS device, this is not going to work.
If there was a print utility that could be called from VB.NET, that would suffice, if there is no way to send text directly to a printer driver in VB.NET.
|
|
|
|
|
So what?? I shows you how to print directly to the printer without going through all the GDI stuff to draw an image of the page.
Once you can get directly to the printer, you can send it all the commands you want that are native to that printer.
|
|
|
|
|
I am doing a bar chart using a date variable and a double variable. I am having trouble reading in the date. Do I have to read in the date using seperate variables for the date?
Regards
Zeldacat
|
|
|
|
|
Hey
Post up a small snippet of code so we can see what is going wrong and trying to help you. By small I dont mean the entire code base but a simplified version of what is happening.
You could even try using a small simplified function or here is a crazy idead - test and debug the function (I have heard people do that sometimes).
Dan
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
I am doing an Example of creating barcharts in VB.
I am using two variables
Thedate as date = Today
Theweight as double
The weight is input on a daily basis via a textbox. The date is taken from the pc's calender. I have a sample to go by, which uses integers and doubles as variables. Everything i have tried so far gets errors because of the date.
Dim NumberGames As Integer
Dim DStreak(144) As Double
Private Sub frmPlot_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Streak As Integer
'Open file, load data in arrays
FileOpen(1, AppPath() + "mar95.csv", OpenMode.Input)
NumberGames = 0
Do Until EOF(1)
Input(1, NumberGames)
Input(1, Streak)
DStreak(NumberGames) = CDbl(Streak)
Loop
FileClose(1)
picPlot_Paint(Nothing, Nothing)
End Sub
The above code is what i am trying to follow.
i hope this helps
thanks
Regards
Zeldacat
|
|
|
|