471,313 Members | 1,964 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,313 software developers and data experts.

Geometry-Sample to explain OOP in C#

Hello,

do you know an URL for me where to find a sample for an abstract
Geometry class, where classes like Point, Line, Area are inherited.
This sample should explain OOP (what is inheritance, polymorphism,
encapsulation, ...)

Thank you,
Norbert
Sep 6 '08 #1
3 2671
It may not be exactly what you want but the animation example on my site has
some simple graphical objects that derive from a base.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"Norbert Pürringer" <th*******@graffiti.netwrote in message
news:48**********************************@z66g2000 hsc.googlegroups.com...
Hello,

do you know an URL for me where to find a sample for an abstract
Geometry class, where classes like Point, Line, Area are inherited.
This sample should explain OOP (what is inheritance, polymorphism,
encapsulation, ...)

Thank you,
Norbert
Sep 6 '08 #2
Inherited from what? A Shape class?

I can help you out if you're willing to spend a lousy five or six bucks on a
used book. Go to Amazon and buy a copy of the C# Class Design Handbook
published by Wrox. Just plug in your words and you're all set with an entire
treatise that covers the spectrum of OOP as it pertains to its fundamental
unit; the class.

Then you can write the next AutoCAD :-)

Answer for extra credit: minimum number of vectors required to initialize a
3D primitive object which is derived from the least number of instances of
the Line class as possible. Its a two part question: What is the least
primitive object and what are its properties?

You can plug thoughts like that into the C# Class Design Handbook and get
insight out the other end. For less than ten bucks.

"Norbert Pürringer" <th*******@graffiti.netwrote in message
news:48**********************************@z66g2000 hsc.googlegroups.com...
Hello,

do you know an URL for me where to find a sample for an abstract
Geometry class, where classes like Point, Line, Area are inherited.
This sample should explain OOP (what is inheritance, polymorphism,
encapsulation, ...)

Thank you,
Norbert
Sep 6 '08 #3
Hello,

thank you for your advises.

I have written a geometry sample by my own. As guide I used the Simple
Feature Access specification by OGC. There is an abstract Geometry
object and descendants like Point, Polyline, Polygon and
GeometryCollection.

The Geometry class contains the abstract properties or methods like
GeometryType, Is3D, Empty and GetWKT. GetWKT is a quite good sample to
explain polymorphism. You can call this function for each geometry
object. The sub class implements the Well Known Text algorithm.

Thank you again,

Norbert
Sep 7 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Will McGugan | last post: by
reply views Thread by Gabriel B. | last post: by
1 post views Thread by Shankar Iyer (siyer | last post: by
reply views Thread by Clive Page | last post: by
7 posts views Thread by Maxim Shemanarev | last post: by
3 posts views Thread by Otavio Macedo | last post: by
7 posts views Thread by Chris | last post: by
12 posts views Thread by gsal | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.