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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:27:46+00:00 2026-06-01T07:27:46+00:00

So i have a class name repository which is just a simple array.Here is

  • 0

So i have a class name repository which is just a simple array.Here is a part of the class:

template<class Element>
class repository {
private:
    int size;
    int capacity;
    Element* elements;

I have another class named participant.I want to have a repository of participants and perform actions on that repository using a new class named controller.But I don`t know how to declare the type of the repository in the controller.

Here is a part of the class participant:

class participant {
private:
    int position;
    int score;

And here is a part from the class controller:

#include "repository.h"
#include "participant.h"
class controller {
private:
    repository repository;
    repository temporary;
    void createCopy();
public:
    controller();
    controller(repository repo);

And I get the errors:

-invalid use of template-name ‘repository’ without an argument list int the lines with repository repository and repository temporary;

-expected ‘)’ before ‘repo’ in the line with controller(repository repo);

How should I declare the type for the repository and temporary in the declaration of class controller so that I won`t get any other 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-01T07:27:48+00:00Added an answer on June 1, 2026 at 7:27 am

    Repository is a class template, so you need to declare your data members as

    private:
        repository<SomeType> repository; // but this hides repository name
        repository<SomeType> temporary;  // repository has another meaning now!
    

    where SomeType in this case is probably participant. repository by itself doesn’t name a type, repository<int> or repository<std::string> etc. does. Next, your data member name cannot be repository, since that is the template name needed for temporary. So change the name of the data member:

    private:
        repository<SomeType> repo_;
    

    Likewise, your constructor must take a type:

    controller(repository<participant> repo);
    

    although you probably want to pass repo by const reference:

    controller(const repository<participant>& repo);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have repository class in asp.net mvc which has this, public Material GetMaterial(int id)
I have an class library called ServiceLayer which acts as a repository for a
I have a Generic Repository class, see below, which is used to perform common
I have a repository class which is querying the EF DbContext like this: public
I have simple item model with name and quantity: public class Item extends CouchDbDocument{
I have two lists user.Roles repository.Roles and RoleViewModel public class RoleViewModel { public int
I have a class Person and a class Name. Name contains two Strings firstName
Assuming I have only the class name of a generic as a string in
I have a class like this, public class person { name Name {set; get;}
If I have a python class, how can I alias that class-name into another

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.