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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:07:55+00:00 2026-05-25T12:07:55+00:00

class Allegro {}; class Input { private: Allegro allegro1 }; class Graphics { private:

  • 0
class Allegro {};

class Input
{
private:
    Allegro allegro1
};

class Graphics
{
private:
    Allegro allegro2
};

class Game
{
private:
    Input keyBoardinput;
    Graphics Gamegraphics;
};

In the input I need access to Allegro functions related to the user keyboard input. In the Graphics class,I want only functions that will enable me to draw things on the screen, like shapes etc. However the Game class also needs access to Input and Graphics functions while the game is playing.Any ideas on how I can improve the design. I know I can remove the Graphics and Input classes and have all the Allegro functions inside Game class, because what I want to do is to separate implementation and logic and to also avoid long classes that do too many things.

  • 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-25T12:07:56+00:00Added an answer on May 25, 2026 at 12:07 pm

    Obviously, Graphics and Input should be talking to the same Allegro class. So you should do that: create the Allegro class instance, then use that instance in the constructors for Graphics and Input.

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

Sidebar

Related Questions

Class hierarchies and constructors are related. Parameters from a child class need to be
class LinkedList{ private $first; public function Merge(LinkedList $ll){ //We can't access $ll->first for merging
class Test extends JPanel implements MouseListener { private JButton b1, b2, b3, b4; public
class MainPage(webapp.RequestHandler): def get(self): user = users.get_current_user() tasks_query = Task.all() tasks = tasks_query.fetch(1000) if
class myClass { public $user=array( 'first_name' => 'Andi', 'last_name' => 'Abdulloh', 'result' => array('A','B','C','D','E'));
class ApplicationContext{ private final NetworkObject networkObject = new networkObject(); public ApplicationContext(){ networkObject.setHost(host); networkObject.setParams(param); }
class Message(db.Model): user = db.ReferenceProperty(User, required=True, collection_name='Message_set') text = db.TextProperty(required=True) I tried this but
class Foo { static bool Bar(Stream^ stream); }; class FooWrapper { bool Bar(LPCWSTR szUnicodeString)
class Tag(models.Model): name = models.CharField(maxlength=100) class Blog(models.Model): name = models.CharField(maxlength=100) tags = models.ManyToManyField(Tag) Simple
class A : IFoo { } ... A[] arrayOfA = new A[10]; if(arrayOfA is

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.