Add C++ nested class example
This also reverts the nested class additions to the Java/C# 'class' example so that the 'class' example remains identical across different language modules
This commit is contained in:
parent
b65ba2a8db
commit
2d518c638c
22 changed files with 802 additions and 18 deletions
|
|
@ -2,19 +2,17 @@
|
|||
|
||||
class Shape {
|
||||
public:
|
||||
struct Counter{
|
||||
static int nshapes;
|
||||
};
|
||||
Shape() {
|
||||
Counter::nshapes++;
|
||||
nshapes++;
|
||||
}
|
||||
virtual ~Shape() {
|
||||
Counter::nshapes--;
|
||||
nshapes--;
|
||||
};
|
||||
double x, y;
|
||||
void move(double dx, double dy);
|
||||
virtual double area(void) = 0;
|
||||
virtual double perimeter(void) = 0;
|
||||
static int nshapes;
|
||||
};
|
||||
|
||||
class Circle : public Shape {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue