Я пытаюсь построить класс под названием Arraybag, и у меня проблемы с моим компилятором, который дает мне эту ошибку. < /p>
Цель класса состоит в Уметь принять большинство простых типов данных в массиве All All.//
#include
// Constructor; creates and initializes an empty Bag
template
ArrayBag::ArrayBag()
{
itemCount = 0;
}
// Return the number of Items being stored in the Bag
template
int ArrayBag::getCurrentSize() const
{
return itemCount; // STUB
}
// Return the capacity of the bag (the maximum Items it can store)
template
int ArrayBag::getCapacity( ) const
{
return DEFAULT_CAPACITY;
}
// Report whether the Bag is empty
// Return true if the Bag is empty (storing no Items);
// Return false if Items exist in the Bag
template
bool ArrayBag::isEmpty() const
{
return (itemCount == 0);
}
// Report whether the Bag is full
// Return true if the Bag is filled to capacity
// Return false if there is still room
template
bool ArrayBag::isFull() const
{
return (itemCount == DEFAULT_CAPACITY); // STUB
}
// Give the Bag a new Item to store
// If Bag is full, nothing changes
// Else, Bag must add this Item to its Item array and update its itemCount
// If Bag is full after this, return true; else return false
template
bool ArrayBag::add(const ItemType& newItem)
{
if(itemCount == DEFAULT_CAPACITY)
{
cout
Подробнее здесь: https://stackoverflow.com/questions/214 ... fore-token
Ошибка класса шаблонов "ожидаемый инициализатор до '<' token" ⇐ C++
Программы на C++. Форум разработчиков
-
Anonymous
1739566451
Anonymous
Я пытаюсь построить класс под названием Arraybag, и у меня проблемы с моим компилятором, который дает мне эту ошибку. < /p>
Цель класса состоит в Уметь принять большинство простых типов данных в массиве All All.//
#include
// Constructor; creates and initializes an empty Bag
template
ArrayBag::ArrayBag()
{
itemCount = 0;
}
// Return the number of Items being stored in the Bag
template
int ArrayBag::getCurrentSize() const
{
return itemCount; // STUB
}
// Return the capacity of the bag (the maximum Items it can store)
template
int ArrayBag::getCapacity( ) const
{
return DEFAULT_CAPACITY;
}
// Report whether the Bag is empty
// Return true if the Bag is empty (storing no Items);
// Return false if Items exist in the Bag
template
bool ArrayBag::isEmpty() const
{
return (itemCount == 0);
}
// Report whether the Bag is full
// Return true if the Bag is filled to capacity
// Return false if there is still room
template
bool ArrayBag::isFull() const
{
return (itemCount == DEFAULT_CAPACITY); // STUB
}
// Give the Bag a new Item to store
// If Bag is full, nothing changes
// Else, Bag must add this Item to its Item array and update its itemCount
// If Bag is full after this, return true; else return false
template
bool ArrayBag::add(const ItemType& newItem)
{
if(itemCount == DEFAULT_CAPACITY)
{
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/21419014/template-class-error-expected-initializer-before-token[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия