By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,954 Members | 1,248 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,954 IT Pros & Developers. It's quick & easy.

Geometry-Sample to explain OOP in C#

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.