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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:51:18+00:00 2026-06-05T09:51:18+00:00

I have a function in header file Class2.hpp of the form: class Class2{ void

  • 0

I have a function in header file Class2.hpp of the form:

class Class2{
void Test::func(std:: string & text, Class1::enum_var var1, unsigned var2, unsigned     &var3);};

I have Class1 of the form:

  class Class1{
  public:
 /// Different literal types
  enum enum_var {
  enum_var1, enum_var2, enum_var3
 }; };

I have defined the above function in Class2.cpp as

 void Test::func(std:: string & text, Class1::enum_var var1, unsigned var2, unsigned     &var3){
 cout<<"inside the function";
 }

Now I am calling the above function as:

Class2 clsObj;
std::string text="abc";
int var3=0;
clsObj.func( text, Class1::enum_var1, 0, &var3);

However, when I am running the program its giving me the following errors:

 error: no matching function for call to ‘Class2::func(std::string*,   Class1::enum_var1,  int, int*)’
 note: candidate is:
 void Class2::func(std::string&, Type::ID, unsigned int, unsigned int&)
 note:  no known conversion for argument 4 from ‘unsigned int*’ to ‘unsigned int&’

I am not getting how to get rid of the error..can someone be kind enough to help PLEASE.

Also, I want the changes in var3 to be reflected back…therefore apart from returning or passing by reference I have no choice..and when I pass var3 by reference its giving me errors.

  • 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-05T09:51:19+00:00Added an answer on June 5, 2026 at 9:51 am
    clsObj.func(& text, Class1::enum_var1, 0 &var3);
    

    should be:

    clsObj.func(text, Class1::enum_var1, 0, var3);
    

    Reference is an alias to the object being referred and the refferant is accessible just by the reference name.

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

Sidebar

Related Questions

I have the following code <div class=framepage> <header> <script type=text/javascript> function getBaseUrl() { return
I have this definition of the function in my class. The .hpp file: class
I have a function (assign) in a class (graph) in a header file. The
I have a class which defines the following members in a header file (.hpp):
I have a class Class1 in some header file Class1.hpp class Class1 { static
in header file I have defined the following function #ifndef OS_H #define OS_H #include
I have the following: in header: <script type=text/JavaScript> $(document).ready(function() { $(.modal).fancybox({ // for modals
Have a look at the following piece of code Header File: class CxUser {
This is for C++. Usually we have our function declaration in header file and
Basically I have code which looks like this inside a header file: class Bar;

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.