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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:56:07+00:00 2026-06-02T11:56:07+00:00

I have a header in which I declare a function. Then I create the

  • 0

I have a header in which I declare a function. Then I create the function and try to use it but i get an error. It is by reference but I don’t know why it is not working.

struct.h

#ifndef LISTSTRUC_H_
#define LISTSTRUC_H_


template <class T> struct Array{
    int days;
    T * M;

Array( int size ) : days(size), M(new T[size])
{
}
~Array()
{
   delete[] M;
}
};

void currentDay();

template <class Expe>
void dummyData(Array<Expe> &);

#endif /* LISTSTRUC_H_ */

struct.cpp

void dummyData(Array <Expe> &A){
for(int i=0; i<31; i++){
    A.M[i].Expe::setObj((i*3),(i*1),(i*6),(i*2),(i*4),(i*5));
}
 }

M.cpp(Main cpp)

int main(){
//Main function of the program. no pre/ post condition.

    Array <Expe> A(31);   // Work space
    Array <Expe> B(31);   // Backup space

    dummyData(&A);         // error
 }

ERROR:

..\M.cpp:22:14: error: no matching function for call to 'dummyData(Array<Expe>*)'
  • 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-02T11:56:08+00:00Added an answer on June 2, 2026 at 11:56 am
    dummyData(&A);
    

    should be:

    dummyData(A); 
    

    Rationale:
    Your function takes a reference not a pointer, &A means you are passing address of the type which can only be received in by a pointer to that type and you don’t have that overloaded version of the function, hence the error.

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

Sidebar

Related Questions

I have a header.html which start with session_start();. Then the following code, $_SESSION['cart'][$sw_id] is
I have a header which I constructed like this: <header class=top> <a href=> <span
Hope someone has an easy answer on this. I have a header image which
I want to reimplement a library of which I have the header file. I
I'm trying to write a framework library which wraps MPI. I have a header
In a table of mine I have the table header, th which have two
I have an abstract class which contains method for setting header text. It looks
I currently have a custom TabItem which has a custom header, which is defined
I have an alertview which displays fine. In my header I've included the UIAlertViewDelegate,
Currently, I have an Application which consists of a BasePage which as a header

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.