Hi all,

I am new in C++, I wonder if anyone could assist me about create a two classes.

Basically I need to create class scale and translate where these two classes are inheritance from transition class.

In the scale class contain e.g
Public:
scale();
~scale
draw();
operator >>;

same as translate.

And the transition class contains:
protected:
vector3D vec;

How can I create these classes ? Can anyone give me some idea please.
Thanks.

Well, let's start with what you've already tried. Can you post your existing code, if any (using CODE tags, if you please)? Do you have any specific questions about how to do this?

Edited 3 Years Ago by happygeek: fixed formatting

This is what I have done so far but I am not sure if the classes for scale and translate are correct here - Can anyone please assist me. Thanks.

file: Transition.h
#define Transition_h
 
#include "Drawable.h"
#include "Painter.h"
 

class Transition : public Drawable, public Painter, public Drawable {
 
 
protected:
    null vector3D vec;;
};
 
file:Transition.cpp
#include "Transition.h"
 
File:scale.h
#define Scale_h
#include "Transition.h"
 
class Scale : public Transition {
 
public:
 
    virtual void scale();
 
    virtual void ~scale();
 
    virtual void draw();
 
    virtual void operator >>;
};
 
File.scale.cpp
 
#include "Scale.h"
 
void Scale::scale()
{
}
void Scale::~scale()
{
}
void Scale::draw()
{
   
}
 
void Scale::operator >>
{
}
 
file:Translate.h
 
#define Translate_h
#include "Transition.h"
 
class Translate : public Transition {
 
public:
 
    virtual void translate ();
 
    virtual void ~translate ();
 
    virtual void draw ();
 
    virtual void operator >>;
};
 
file:Translate.cpp
#include "Translate.h"
 
void Translate::translate ()
{
}
 
void Translate::~translate ()
{
}
void Translate::draw ()
{
   
}
void Translate::operator >>
{
}

Edited 5 Years Ago by siabenie: n/a

Could you please edit your previous post so that the code sections are in [CODE] tags? The forum software does not retain formatting by default, so the only way to be able to read the code clearly is with code tags.

Edited 5 Years Ago by Schol-R-LEA: n/a

Thanks I have edited them.

Basically my UML look a bit like this and have these elements:

Node
Public:
node();
virtual ~node();
virtual draw() voice = 0;

Transition class is inheritance from Node class.
Protected:
vector3D vec;

Translate class and scale class inheritance from Transition class:

Translate:
Public
translate();
~translate();
draw () void;
operator >>;

Scale
Public
scale();
~scale();
draw() void;
operator >>

I am trying to create a shape 2D e.g for polygon, circle, shape etc but that would be in a different classes - For now I need to create the scale, translate and transition class first - Can anyone suggest me an idea how to do this?
Many thanks.

Edited 5 Years Ago by siabenie: n/a

Hi all,

I wonder if anyone could assist me here.

Hre I have done some of the classes that I need to created and explain the brief about the UML overview:

Node:
Public:
node()
virtual ~node();
virtual void draw() = 0;

Transition
Protected:
vector 3D vec;

Translate:
Public:
translate();
~translate();
void draw();
operator >>;

Scale:
Public:
scale();
~scale();
void draw();
operator >>;

Vector3D
Private:
float x,y,z;

Public:
vector3D();
~vector3D();
getX();
getY();
getZ();
operator >>;

Basically, the abstract based class which is Drawable contains a virtual void member function call draw()- Also this
contains vector3D holding and giving access to 3 float values.
There are 2 abstract inheriting drawbale: Shape (for real-object classes which is polygon and circle) and Transition
for openGL navigation / formatting actions (in this UML would be scale and translate).

My first concern here is to implement the abstract transition which contains the two classes (scale and translate)

Both classes should have the file .h and .cpp

//File: transition.h
#define transition_h
 
#include "node.h"
 
 
class transition : public node{
 
 
protected:
    vector3D vec;;
};
 
//File:transition.cpp
#include "transition.h"
 
//File:scale.h
#define scale_h
#include "transition.h"
 
class scale : public transition {
 
public:
 
    virtual void scale();
 
    virtual void ~scale();
 
    virtual void draw();
 
    virtual void operator >>;
};
 
//File.scale.cpp
 
#include "scale.h"
 
void scale::scale()
{
}
void scale::~scale()
{
}
void scale::draw()
{
   
}
 
void scale::operator >>
{
}
 

//file:translate.h
 
#define translate_h
#include "transition.h"
 
class translate : public transition {
 
public:
 
    virtual void translate ();
 
    virtual void ~translate ();
 
    virtual void draw ();
 
    virtual void operator >>;
};
 
//File:translate.cpp
#include "translate.h"
 
void translate::translate ()
{
}
 
void translate::~translate ()
{
}
void translate::draw ()
{
   
}
void translate::operator >>
{
}

Edited 4 Years Ago by siabenie: n/a

This article has been dead for over six months. Start a new discussion instead.