2

When runnig my project i see these problems. Does anyone know the solution? 'std array': too few template arguments. cannot use this indirection on type 'std::array'. too few arguments for class template "std::array". I tried to remove using namespace std; into std::array or cli::array but it didn't helped a lot

#include "pch.h"
#include "windows.h" 
#include <iostream> 
#include <string> 
using namespace System;
using namespace std;
class Dog
{
public:
  Dog();
  Dog(int initAge);
  ~Dog();
  int GetAge();
  void SetAge(int Age);
  void GawGaw(string S);
  private: int itsAge;
};

Dog::Dog() 
{ } 

Dog::Dog(int initAge) 
{ 
  itsAge = initAge;
} 

Dog::~Dog() 
{ }

int Dog::GetAge()
{ return itsAge;
}

void Dog::SetAge(int Age) 
{ itsAge = Age; 
} 

void Dog::GawGaw(string S) 
{ cout << S + " -> GawGaw \n"; 
} 

int main(array<System::String ^> ^args) 
{ 
  cout << "\n My Favorite dogs \n";

  Dog Bob;

  cout << "\nBob is a dog who is ";
  cout << Bob.GetAge() << " years old. \n";
  Bob.SetAge(7);
  cout << "No. Bob is a dog who is ";
  cout << Bob.GetAge() << " years old. \n";
  Bob.GawGaw("Bob");

  Dog* Fox = new Dog(10);

  cout << "\nFox is a dog who is ";
  cout << Fox->GetAge() << " years old. \n";
  Fox->SetAge(12);
  cout << "No. Fox is a dog who is ";
  cout << Fox->GetAge() << " years old. \n";
  Fox->GawGaw("Fox");

  Dog Rex(5);

  cout << "\nRex is a dog who is ";
  cout << Rex.GetAge() << " years old. \n";
  Rex.SetAge(8);
  cout << "No. Rex is a dog who is ";
  cout << Rex.GetAge() << " years old. \n";
  Rex.GawGaw("Rex");

  Console::ReadLine();
  return 0;
}
Ðаn
  • 10,934
  • 11
  • 59
  • 95

0 Answers0