•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Game Development section within the Software Development category of DaniWeb, a massive community of 391,590 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,685 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Game Development advertiser:
Views: 1869 | Replies: 3
![]() |
•
•
Join Date: Apr 2005
Posts: 2
Reputation:
Rep Power: 0
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; }
}; Member of: Beautiful Code Club.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Game Development Marketplace
•
•
•
•
advertising ajax asp blogging browser business code console development erp systems firefox game games google hardware intel internet linux marketing microsoft mozilla news nintendo planning playstation programming project project management ps3 revenue rss search security software software selection sony stocks technology evaluation video video game vista w3c web web development wii wiki windows xbox 360 xml yahoo
- Object Oriented Programming (Computer Science and Software Design)
- Parser as a C++ project (Computer Science and Software Design)
- Parser as a C++ project (C++)
- I am from China (C)
- need idea for project using classes and inheritance (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



Linear Mode