Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
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.
Posted 11-Jan-13 22:25pm
Skfc121
Edited 11-Jan-13 23:52pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You have implemented inheritance (triangle), but not the composition or rather aggregation (diamond).
  Permalink  
Comments
Skfc at 12-Jan-13 5:50am
   
how to implement composition or aggregation
«_Superman_» at 12-Jan-13 5:52am
   
You basically create an object of a class as a member of another class.
Skfc at 12-Jan-13 5:53am
   
you mean my 2 last classes are incorrect according to diagram?
«_Superman_» at 12-Jan-13 5:55am
   
They are correct, but incomplete. They do not have a member object.
Skfc at 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)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Comments
Skfc at 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)



Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 12 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100