Geometry-Sample to explain OOP in C#

  • Thread starter Norbert Pürringer
  • Start date
N

Norbert Pürringer

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
 
B

Bob Powell [MVP]

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.
 
H

Hillbilly

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.
 
N

Norbert Pürringer

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top