| | |
Inheritance Project ..
Please support our Game Development advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Apr 2005
Posts: 2
Reputation:
Solved Threads: 0
Hello ...
I must do a mini project on Inheritance ..
It's about 2-D and 3-D shapes..
The base class is point ..
and we must define as many derived classes as we could such as circle .. rectangle .. triangle .. Cylender .... and so on !
The most clsses and functions we include the most grades we will get ..
can you please help me in that .. Ideas ... articles .... Tutorials ... Open codes or any thing related ..
I must do a mini project on Inheritance ..
It's about 2-D and 3-D shapes..
The base class is point ..
and we must define as many derived classes as we could such as circle .. rectangle .. triangle .. Cylender .... and so on !
The most clsses and functions we include the most grades we will get ..
can you please help me in that .. Ideas ... articles .... Tutorials ... Open codes or any thing related ..
>The base class is point .
Inheritance isn't the right solution for point. A shape is not a point. A shape has one or more points, so containment is a better solution. point should be a stand-alone class. I really hate the shape abstraction as a means of introducing inheritance, but consider this:
It's much harder to work out a coherent hierarchy if all of the shapes derive from Point.
Inheritance isn't the right solution for point. A shape is not a point. A shape has one or more points, so containment is a better solution. point should be a stand-alone class. I really hate the shape abstraction as a means of introducing inheritance, but consider this:
struct Point {
int x, y;
};
class Shape {
/* No points */
public:
virtual void draw() const { cout<<"Shape"<<endl; }
};
class Ellipse: public Shape {
Point center;
int radius;
public:
virtual void draw() const { cout<<"Ellipse"<<endl; }
};
class Rectangle: public Shape {
Point top_left;
Point bottom_right;
public:
virtual void draw() const { cout<<"Rectangle"<<endl; }
}; New members chased away this month: 5
![]() |
Similar Threads
- need idea for project using classes and inheritance (C++)
- Object Oriented Programming (Computer Science)
- Parser as a C++ project (Computer Science)
- Parser as a C++ project (C++)
- I am from China (C)
Other Threads in the Game Development Forum
- Previous Thread: Contribute to make an RTS game in DirectX (not tutorial)
- Next Thread: How to Use Windows Mode Graphics
Views: 2784 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for Game Development
3d advertising ai algorithm ban c++ cambridge camera censorship china competition console development engine fov fpx game gamedevelopment gameprogramming gamer games gaming gauntanamo government graphics idaho in-gameadvertisement intel intellectualproperty l-systems laracroft larrabee lindenmayer live manhunt math mathematics matrix mercenaries microsoft mmorpg modded msn multicore naked news nintendo obama opengl palin physics pirate playstation politics processor projection ps3 rpg search selection software sony stephenhawking stocks studio technology terrorism tombraider uk videogame web wii world-of-warcraft xbox xbox-live xbox360






