UML类图中的C ++类 [英] C++ Classes from UML Class Diagram

查看:235
本文介绍了UML类图中的C ++类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



根据班级图表,你能确认我创建的课程是否正确



类图

https:// skydrive。 live.com/redir?resid=8B2D8A874799F882!158&authkey=!AGWdCBkmuXTfLLA [ ^ ]



我的代码:





Hi Friends,

Can you confirm that classes that i have created are correct or not according to Class diagram

Class diagram
https://skydrive.live.com/redir?resid=8B2D8A874799F882!158&authkey=!AGWdCBkmuXTfLLA[^]

my code:


#ifndef PROPERTYCATEGORIES_H
#define PROPERTYCATEGORIES_H


class PropertyCategories
{
    public:
        PropertyCategories();
        virtual ~PropertyCategories();

    protected:

    private:
    string SocietyName;
    int Area;
};


class Plot : public PropertyCategories
{
    public:
        Plot();
        virtual ~Plot();
    protected:

    private:
        int PlotNo;
};

class Flat : public PropertyCategories
{
    public:
        Flat();
        virtual ~Flat();
    protected:

    private:
        int FlatNo;
};


class House : public PropertyCategories
{
    public:
        House();
        virtual ~House();
    protected:

    private:
        int HouseNo;
};







#endif // PROPERTYCATEGORIES_H











>注意:我不需要在程序中实现此代码。






>NOTE: I don''t need to implement this code into the program.

推荐答案

您已经实现了继承(三角形),但没有实现组合或聚合(钻石) )。
You have implemented inheritance (triangle), but not the composition or rather aggregation (diamond).


询问Google怎么样?

例如对于聚合和组合: http://en.wikipedia.org/wiki/Object_composition [ ^ ]。

例如继承:http://en.wikipedia.org/wiki/Implementation_inheritance [ ^ ]。

阅读并理解这些内容,然后才开始实施。

干杯

Andi
How about asking Google?
E.g. For Aggregation and composition: http://en.wikipedia.org/wiki/Object_composition[^].
E.g Inheritance: http://en.wikipedia.org/wiki/Implementation_inheritance[^].
Read and understand these, then only start to implement.
Cheers
Andi


是的。他们是对的。请将方法添加到类图中定义的相应类中。如果您想修改问题,可以更新问题。
Yes. they are right. Please add the methods to the respective classes as defined in the class diagram. you can update questions if you want to modify your question.


这篇关于UML类图中的C ++类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆