Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7622147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:22:44+00:00 2026-05-31T04:22:44+00:00

If a class contains pointer to a singleton class, can it be aggregation ?

  • 0

If a class contains pointer to a singleton class, can it beaggregation?

To my understanding it cannot be a has-a relationship since the class does not make an instance of the singleton class, it is just using it like association relationship.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:22:46+00:00Added an answer on May 31, 2026 at 4:22 am

    The title doesn’t make 100% complete sense as written. There are singleton classes, but there aren’t really singleton relationships. Any relationship can be assigned a multiplicity at either end, so if you mean one-to-one relationships, all you do is assign multiplicity 1 at both ends.

    Classes can also have multiplicities. You don’t often see this used, except in one case: singletons.

    When it comes to A having or containing or referencing B, there are basically three levels of tightness in UML.

    Aggregation (unfilled rhomboid arrow head) implies that the containment is not exclusive and that the contained object does not share any aspect of its lifecycle with the containing object. In implementation, this is typically a pointer.

    Composition (filled rhomboid arrow head) implies that the contained object gets destroyed when the containing object does. Getting this to work usually means that the containment is exclusive. In implementation, this is often a pointer whose destructor is called in the destructor of the containing class (although it may not be created in the constructor of the containing class).

    Directed association or member attribute (same thing in UML) implies that the contained object is part of the state, or a constituent if you will, of the containing object. In implementation, this typically means that the reference is not a pointer, or if it is that the contained object is co-created and -destroyed with the containing object.

    Aggregation of a singleton is perfectly permissible (even from several different classes), because aggregation is by definition non-exclusive.

    Composition is a bit iffy, unless the containing class is also a singleton.

    Attribute / directed association is most likely wrong. If the containing class is a singleton, it doesn’t make any sense to make the contained class a singleton as well since that’s implied. And if the contained class is used as a member in two different classes, it cannot be a singleton.

    In addition to the above, you can also of course add as many Usage relationships as you wish. This is common in all design, and implies that the class at the source end of the relationship calls methods in the class at the target end.

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Singleton which has an NSMutableArray containing a Class, the Class contains
I have a class which contains a static collection that can be used across
I have a class that contains data from some model. This class has metadata
I have a URes class which contains a single pointer to <T> , with
I have a managed class which contains unmanaged class pointer: class Managed { public
I have a C++ template class that contains a method pointer and a class
I'm trying to create a class which contains a static pointer to an instance
I am trying to make a class that contains two other objects, and those
In my project I have implemented basic class CVector. This class contains float* pointer
I have a class that contains a pointer to a constant VARIANT value outside

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.