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

  • Home
  • SEARCH
  • 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 8754341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:35:56+00:00 2026-06-13T13:35:56+00:00

In OOP, you want to break apart a program into multiple classes. In C#,

  • 0

In OOP, you want to break apart a program into multiple classes.

In C#, you would do as such:

namespace a
{
  public class ClassA
  {
     //Methods...that are defined and have code in them.

  }
}

and to use that class, you just do “using namespace a;”.

Say I want to create a class in C++, and define them, and put code in them.

class ClassA
{
  public:
   void methodA();
}

ClassA::methodA()
{
  //implementation.
}

To access this implementation, you would just use #include “ClassA.h”. I fully understand that, and then you have to implement that code again? That seems counterproductive as I like to spread my project over a lot of classes.

So what would be the proper procedure to implement ClassA and not re-implement all it’s methods again?

  • 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-13T13:35:57+00:00Added an answer on June 13, 2026 at 1:35 pm

    You don’t have to reimplement them in each CPP file, the C++ linker takes care of making sure the definitions get matched together.

    All you need is:

    A header:

    #ifndef FOO_H
    #define FOO_H
    
    class Foo{
      //Junk goes here
    };
    
    #endif
    

    A cpp:

    #include "foo.h"
    
    //implementations for junk goes here
    void Foo::junk(){
    
    }
    

    And then you can include foo.h. Each cpp will be compiled to a .o file. Than, those .o files are handed to the linker which can figure out where definitions are and piece together the code correctly.

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

Sidebar

Related Questions

Introductory OOP question for you: Situation: I want an abstract class with a public
I know that in OOP you want every object (from a class) to be
I am learning Java OOP. My program downloads file via FTP. I want to
I have some c++ OOP classes (separated files) , and I want to create
Basic OOP question... I want to add a couple functions to the Array class
I would like to learn PHP and want to get an Idea about OOP
I want to make variables and methods in php class. And want to use
I have this problem since I'm beginning in OOP programming I want to close
I am learning OOP with python. I want to implement something like to display:
I started learning OOP applied to C++. Now I want to know if I

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.