Like Tree2Likes
  • 1 Post By manasij7479
  • 1 Post By phantomotap

composition relations

This is a discussion on composition relations within the C++ Programming forums, part of the General Programming Boards category; Hi Guys, I want to make a program and in that program I want to make a composition relations. Eg. ...

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    96

    composition relations

    Hi Guys,

    I want to make a program and in that program I want to make a composition relations.

    Eg. I have a class of "Vehicle" and a class of "Bus".

    Vehicle class has general data members which are inherited by class "Bus".

    But I wanted to know that how can I show composition relations between these 2 classes of "Vehicle" and "Bus"?

    eg.

    Code:
    class Vehicle
    {
    private :
    
    int regno;
    char name;
    
    public:
    get int regno();
    get char name();
    
    };
    
    
    class Bus : public Vehicle
    
    {
    private:
    char buscolor;
    
    public:
    get int regno();
    get char name();
    
    };
    Now how can i show a composition relation between class "Bus" and the "Vehicle"?

    Thanks

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,430
    Quote Originally Posted by student111
    But I wanted to know that how can I show composition relations between these 2 classes of "Vehicle" and "Bus"?
    What is "composition"? Does such a relationship make sense between "Vehicle" and "Bus"?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    Quote Originally Posted by laserlight View Post
    Does such a relationship make sense between "Vehicle" and "Bus"?
    Of course it does !
    Have an open mind.
    GReaper likes this.
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  4. #4
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,171
    STUDY A ........ING BOOK!

    I can't believe this crap.

    Why are you trying to pull a working programming knowledge from the ..... of the regulars at this forum?

    You approach is unbelievable stupid. I'm having more trouble wrapping my mind around your level of stupidity than I had with Calculus.

    If you'll just read a book you'll find all the answers to these easily searchable questions.

    Heck, if you just bothered to read the answers from the four forums you shotgun this crap at you would be significantly less stupid.

    [Edit]
    Removed some language the forum software did not.
    [/Edit]

    Soma

    Program of inheritance
    further about Inheritance
    About string and stlib
    Hi some questions
    read from input file
    some questions about structure
    Some problem with my program
    Last edited by phantomotap; 06-19-2012 at 06:28 AM.
    rags_to_riches likes this.

  5. #5
    Registered User antred's Avatar
    Join Date
    Apr 2012
    Location
    Germany
    Posts
    227
    That was kind of harsh. =0

  6. #6
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,171
    That was kind of harsh.
    Fair enough in your opinion, but before you hold me to be too harsh read all of his posts.

    Not only is he doing himself a great disservice in the approach, he is wasting a lot of time a lot of people donate by asking the same or extremely similar questions over and over on many different forums occasionally at the same freaking time.

    Someone, I'm not sure who, has been denied the benefit of the time the regulars at these forums contribute because they wasted it on this individual.

    Oh, and I don't even think he is a troll; if I though he was a troll my turn would have been worse but unwritten.

    Soma

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help to do a calcutalor for arithmetic and relations !!!!Pls
    By ryannguyen100 in forum C++ Programming
    Replies: 1
    Last Post: 10-26-2011, 10:43 PM
  2. Composition
    By Fatima Rizwan in forum C++ Programming
    Replies: 4
    Last Post: 10-31-2009, 09:39 AM
  3. Difference Equations / Recurrence Relations
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 10-05-2007, 10:26 AM
  4. Need help with Composition
    By cuddlez.ini in forum C++ Programming
    Replies: 3
    Last Post: 10-25-2004, 08:28 PM
  5. composition, i think
    By blight2c in forum C++ Programming
    Replies: 3
    Last Post: 05-01-2002, 08:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21