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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:58:55+00:00 2026-06-05T13:58:55+00:00

So, I am looking to make my code cleaner. Here is what I have:

  • 0

So, I am looking to make my code cleaner. Here is what I have:

obj.hpp

class obj {
    obj();

    int return0();
};

obj.cpp

using namespace obj; //illegal!!
obj() { }

int return0()
{
    return 0;
}

Basically, I think that writing obj::return0()... is a bit redundant. This becomes trickier when I have sub-classes, where I do things like obj::child::child2::return0()...

Any ideas?

  • 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-05T13:58:56+00:00Added an answer on June 5, 2026 at 1:58 pm

    using namespace x lets you call functions in x, not define them.

    As a comment pointed out, you can inline the function in the header file if it’s short.

    obj.hpp

    class obj {
        obj(){}
        int return0(){return 0;}
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking to code me a banner management system that has users make
Im looking to make my own implementation of these Identicons or Gravatars found here
How do I make code like this thread safe? public static class Converter {
I am trying to make some code regarding USB HID devices. I have found
I'm looking for some best practice advice here. I have a library that I'd
I'm looking to make a recursive method iterative. I have a list of Objects
So in a game I am looking to make I am trying to have
I'm looking to make a website that will probably get some heavy, repetitive traffic.
I'm looking to make a show action of one of my controllers the root.
We are looking to make a final decision on our Mocking framework. After trying

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.