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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:09:17+00:00 2026-06-07T00:09:17+00:00

I have the code: // class declaration class Vector3D; // class declaration and definition

  • 0

I have the code:

// class declaration
class Vector3D;

// class declaration and definition
class Point3D { 
    // ...

    // function declaration (only needs class declarations)
    Point3D operator+(const Vector3D &);
};

// class definition
class Vector3D {
    // ...
};

// function definition (needs class definitions)
inline Point3D Point3D::operator+(const Vector3D &vector) {
    // ...
}

But I get errror:
‘Graphic::Point3D::operator +’ : redefinition; different type modifiers

  • 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-07T00:09:18+00:00Added an answer on June 7, 2026 at 12:09 am

    The code in your question is well-formed. The Visual C++ 2012 Release Candidate accepts the code without error (I mention this because the text of your error is identical to that of Visual C++ error C2373).

    Either your compiler has a bug, or the code you present in your question is not the same as the code you are compiling.


    In any case: an operator+ does not need to be a member function. It would be simpler to use a nonmember function (or two, to handle different operand orderings):

    Point3D operator+(Point3D  const& lhs, Vector3D const& rhs);
    Point3D operator+(Vector3D const& lhs, Point3D  const& rhs);
    

    If you do keep your operator+ member function(s), they should be const-qualified so that they can be called with a const-qualified left-hand argument:

    Point3D operator+(const Vector3D &) const;
                                        ^ const required
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the code: class Vector3D : public Vector{ protected: Point3D * start; Point3D
I have the code: class Point3D{ protected: float x; float y; float z; public:
Possible Duplicate: What do parentheses surrounding a JavaScript object/function/class declaration mean? I have found
In the following code I have placed anonymous structures inside of my class declaration
I have the following code right after my controller class declaration before_filter :load_form, :except
I have code: class Scene def initialize(number) @number = number end attr_reader :number end
I have this code: class LFSeq: # lazy infinite sequence with new elements from
I have this code: class SomeClass: @classmethod def func1(cls,arg1): #---Do Something--- @classmethod def func2(cls,arg1):
I have below code: class Program { static void Main(string[] args) { Task[] tasks
I have following code class User attr_accessor :name end u = User.new u.name =

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.