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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:29:59+00:00 2026-06-11T20:29:59+00:00

I have a class called product, my problem is that I handle products in

  • 0

I have a class called product, my problem is that I handle products in various ways, either through a list of products, the product itself, and inserting a product into the database. Each handles different properties.

For example, displaying the product on a page will consist of name, description, id, price, brand name, category, image but a list of products would just display just name, thumbnail. Each will have its own methods, for example, one would get top 5 products but the other only displays one product.

My question is how would go about creating classes for this, do I create a different class for each product variation, or create a class consisting of every method and properties thus would consist of a very bulky class.

  • 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-06-11T20:30:00+00:00Added an answer on June 11, 2026 at 8:30 pm
    • Start with an Abstract class called Product.

    • Have all of your common traits/properties/common methods of products in this class.

    • Derive new product types from this abstract class.

    • make properties/methods in the abstract class virtual, so
      deriving product types can exhibit different behavior depending on the product type.

    • See if you require the derived product types to explicitly exhibit a
      specific behavior. declare such methods as abstract in your abstract class. so the derived class is responsible for implementing that behavior.

      abstract class product{

      //member fields
      //methods

      }

       product1:product{
          //product specific implementation
       }
      
       product2:product{
           //product specific implementation
       }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok so I have an abstract base class called Product, a KitItem class that
I have a class called: ComplexNumber and I have a string that I need
I have a class called Flamethrower which naturally has its own ammunition that is
I have a class called Property that I only need to display a few
I have an Abstract type called Product, and five Types that inherit from Product
I have a class called Product in my Business object and in another class
I'm working with a product called SiteFinity. I have a class which looks like
I have a class called BlogHandler that has some basic functionality in it. I
Here's an overview of my problem: I have a templated class called TWMatrix. I've
I have a class called Product with this structure: public class Product { public

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.