Write a program with differenet classes ,to have the information of all the apartments in an appartment building

Posted on 2005-04-07
Last Modified: 2010-04-01
Hi,I am writing a program in C++,for a real estate agent where i can store all the information of different type of appartment ,houses,condominum in different classes,and the info the user when he want to sell or rent the  house.
Can any1 plezz give some ideas ,as how exactly i need to start ,as i have an idea of creating the whole program  by using one main class ,but how to create different classes and merege all all them into the final program.
Question by:anumit
    LVL 9

    Expert Comment

    What O/S do you want the program to run on?
    Do you want it to have a GUI?
    If the answer to the last question is yes, what libraries do you have at your disposal?

    LVL 1

    Accepted Solution

    I'd probably leverage inheritance here since there are some things every dwelling has:

    class Lodging {
      enum { APARTMENT, CONDO, HOUSE, };
      string getAddress ();
      virtual int getLodgingType () = 0;
      int getNumBedrooms ();
      int getNumBathrooms ();
      int getCost ();
      string address;
      int numbr;
      int numbath;
      int cost;

    class Apartment : public Lodging {
      virtual int getLodgingType () { return Lodging::APARTMENT; };
      // ... etc ...

    There are some things Apartments only have and some thing Houses only have and some things Condos only have so you'd probably want to write different classes for each and then keep an array / vector / whatever of Lodging*s.
    LVL 9

    Expert Comment

    plus you also need some sort of storage structure. I recommend Map from STL:

    Actually you would be much better off using SW created specifically for databases - SQL,etc. I am not too much knowledgeable about it but you can ask the same question in databases TA ( and they would provide much better assistance.


    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Article by: SunnyDark
    This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
    Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
    The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
    The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now