Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
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:


C#
#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.
Posted
Updated 23-Feb-21 22:47pm
v2

You have implemented inheritance (triangle), but not the composition or rather aggregation (diamond).
 
Share this answer
 
Comments
Skfc 12-Jan-13 5:50am    
how to implement composition or aggregation
«_Superman_» 12-Jan-13 5:52am    
You basically create an object of a class as a member of another class.
Skfc 12-Jan-13 5:53am    
you mean my 2 last classes are incorrect according to diagram?
«_Superman_» 12-Jan-13 5:55am    
They are correct, but incomplete. They do not have a member object.
Skfc 12-Jan-13 5:57am    
yup ..... I have added members only now plz check are they correct only members not added methods yet(question Updated)
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
 
Share this answer
 
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.
 
Share this answer
 
Comments
Skfc 12-Jan-13 5:54am    
I have updated the question ..... just added members variables now ///// are they corrcet

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900