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 5982943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:09:35+00:00 2026-05-22T22:09:35+00:00

I am designing a class which comprises of objects of other classes, right now

  • 0

I am designing a class which comprises of objects of other classes, right now i am accepting the values to instantiate this class via function parameters. This class is created per session(From the user login to logout). For a session the UserInteraction object will be global i.e:- It can be used from any file at any time. I am planning to allocate memory to the object at user login so that at every user login the object will be ‘new’.

However i am getting a feeling that i am not doing things right. Please advice if I can use any other patterns to improve the code.

class UserInteraction
    {
        private UserDetails _loginDetails; // information of the user logged in.
        private UserFiles[] _userFilesDownloaded; // files downloaded for the user.
        private PrintStatus _printStatus;   // Details of files printed 

        public UserInteraction() { }

        public UserDetails UserInfo {                
            get { return _loginDetails; }
            set { _loginDetails = value; }
        }

        public PrintStatus Status {
            get { return _printStatus; }
            set { _printStatus = value; }
        }

        public UserFiles[] FilesDownloaded {
            get { return _userFilesDownloaded; }
            set { _userFilesDownloaded = value; }
        }
    }
  • 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-22T22:09:36+00:00Added an answer on May 22, 2026 at 10:09 pm

    Before you design some class at least be clear with its responsibilities and collaborations (other objects that it depends on , to perform its responsibilities).

    Try to think who will instantiate/use this object, its life time and how/when it will be destroyed.

    Be clear with these fundamental design principles http://en.wikipedia.org/wiki/Solid_(object-oriented_design).

    As mentioned by @Thomas Levesque,”Don’t try to apply patterns where they’re not needed…”, they are just extensions to good design principles.

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

Sidebar

Related Questions

I am designing a class library which will be used like this: Engine eng
I have trouble when designing classes like this class C1 { public: void foo();
I'm currently designing a custom tab control class which derives from System.Windows.Forms.Control. The problem
I am designing a template class Policy which needs to be able to handle
I am currently designing a class which heavily makes use of reflection by manipulating
I am designing class, which is almost the same for 2d and 3d, so
I am designing an entity class which has a field named documentYear, which might
I'm designing a new class in C# which has a few properties. My users
I now have an event processor class which has a Dictionary to store all
I have a class LocationHelper which I am designing to obtain a user location.

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.