|
Hello everyone!
I need to do a paint software in C# for the university.
I need to use polimorphysm,abstract class,overriding, POO concepts.
I have very dificultties in programmiing so im trying to find something nice to help me here ,but i just find codes for paint without using classes and POO concepts.
Do have something that can helps me?
|
|
|
|
|
mibetty wrote: I need to use polimorphysm,abstract class,overriding, POO concepts. I assume you mean OOP here, I don't now what POO is in your language but ...
The use of these features in your program requires you to do the design. It is not possible to provide a standard set that will do the work for you. You can also find lots of useful suggestions in the CodeProject Articles section[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Errm, it's OOP not POO - POO concepts are something completely different.
If you understand OO, then breaking down your requirements becomes a lot easier. As an example, let's take the fact that you are going to want to draw multiple items, and they are probably going to be of different types. This suggests to me that you are going to have something to manage the collection of items, and that these items will share some common base.
When you consider OOP, you understand that OOP relies on encapsulation, so that everything to do with an item should belong to that item. So, we could figure out that we want to position the item somewhere, and that we want it to have a width and a height. Also, rather than having the code to paint these items on the screen in the paint handler of the application, we should consider that each item should know how to paint itself. So, we have some requirements for these objects - they all share some commonality, and they all have some operations that they must perform, but these operations will depend entirely on the item being drawn. So, I would consider that the X, Y, Width and Height were common (hey, if only .NET provided a handy Rectangle class to do this). The way you paint a rectangle would be different to the way you draw a circle though, so perhaps this should be abstract and require each draw able item to implement it.
As a first pass, I've now got something like this:
public class CanvasManager
{
private List<Shape> shapes = new List<Shape>();
public void AddShape(Shape shape)
{
shapes.Add(shape);
}
public void Paint()
{
foreach (Shape shape in shapes)
{
shape.Draw();
}
}
}
public abstract class Shape
{
public Shape(int x, int y, int width, int height)
{
Bounds = new Rectangle(x, y, width, height);
}
public Rectangle Bounds { get; set; }
public abstract Draw();
} That should give you more than enough to get started, and good luck. Just break your problem down using words and you'll soon get the hang of it.
|
|
|
|
|
Thanks very much all for your awnsewers.
Yes i meant OOP , sorry!
I already look at the code of that "Simple Paint" and others , but the problem is that i need to do a paint using several classes , not only one, i need to use a main class and than others that inherit from the main class.
I also need to use polymorfism , abstract class, overiding,lists..
For example teacher said that i need to have a main class "shape" and than a class for square , rectangle, etc that inherit from shape.
Maybe its something like Pete O'Hanlon wrote, i will try do here something with that
Thanks for trying to help me
|
|
|
|
|
|
Have you looked at the code in there? It's not a great example. Everything is done, pretty much, in one class.
|
|
|
|
|
The simplest way,
Understand the concept with simple example. try with more real life example. and then start working on your project.
best luck
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
That really doesn't add much to the discussion, so why bother posting it? The poster has already indicated that he has made some effort here, and that he just needs some pointers. Your answer was the equivalent of, when somebody asks you for directions to some place, you saying, first you should practice driving up and down this street.
|
|
|
|
|
I am just motivating him.... sometimes people need little bit more effort to get the result and those needs some motivation. And i believe so...
I am sorry if this should not be answer.
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
If the question is clear, and not a request for you to write all the code, then you should offer practical advice. Being given the piece of information you need to solve a problem is a much better motivator and is more help for a poster.
|
|
|
|
|
Thanks for the information. i will keep this in mind and will try to use in my next answers
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
Good job. I look forward to seeing your answers.
|
|
|
|
|
Sure, I will try my best.
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
Is it possible to Decrypt email address which is encrypted using MD5
if yes than please provide me solution
Thanks
|
|
|
|
|
MD5 is a hash-algorithm, not an encryption. It's also a one-way operation, meaning that you cannot "decrypt" it.
|
|
|
|
|
No, it's not. MD5 is a one way hash; in other words, you can't "decrypt" it.
|
|
|
|
|
|
|
Considering MD5 is a lossy hash, there's no way to reverse the hash into what created it. It's entirely possible to have to pieces of source material hash into the exact same value.
|
|
|
|
|
Hash is not intended to be lossless. Therefore you can never guarantee that it can be reversed.
|
|
|
|
|
Sure, do you have the private key? or just tons of time a processing power.
|
|
|
|
|
Do you know how MD5 works?? You cannot reverse the hash to get the original content, even with the private key.
|
|
|
|
|
Yes and just because no one has yet decrypted MD5 doesn't mean that it is unbreakable.
If you take the RSA project as an example then you know that any encrypted string can be decrypted.
The hash function takes a know input in a known form(email address) and performs the function to generate the hash. The are very few functions that do not have a proof and you can use random numbers to try an generate a solution also, email addresses are also in a standard format in me@your.us.com there is an "@" and a period before the teminating string and there are limited terminating strings. So if you know the form of the data and the length or max length and the general properties of an email address and the general properties of the hash function you can decrypt the hash given the time. DO NOT CONFUSE what is unbreakable with what is not yet broken.
You can down vote whatever you feel like but a hash is just a function that is yet to be proven or cracked
modified 20-Nov-12 13:57pm.
|
|
|
|
|
Mathlab wrote: no one has yet decrypted MD5 doesn't mean that it is unbreakable
Noone has done it because MD5 is NOT an encryption! It's a lossy, cryptographic hash.
There is no way to get the original content back from the hash. This is especially true since it is known that multiple, very different, sources can generate the exact same hash value. So, how are you going to determine which one was the original content?
There is no way to do this in any way that anyone would consider "production quality code".
|
|
|
|
|
You can use a lossy but even then you know that its a function, you know the form of the string and you can just input random numbers to start. Its not impossible it just impossible right now and even if its a lossy some of the chaacteristics of the email address are used to create the hash.
|
|
|
|