On-line: гостей 2. Всего: 2 [подробнее..]
Программисты всех стран, объединяйтесь!

АвторСообщение



ссылка на сообщение  Отправлено: 30.10.12 07:02. Заголовок: Template for class


#include <iostream> 
#include <string>

using namespace std;

template< class T >
class Employee{
private:
T EmployeeID , EmployeeSalary;
public:
T Employee( T theID , T theSalary ){
EmployeeID = theID;
EmployeeSalary = theSalary;
}
};

template< class T >
class Student{
private:

public:
T Student(){}

};

int main(){

Employee <> theEmployee( 2 , 3000 );
Student <> theStudent ();

system( "pause" );
return 0;
}


what i done so far

and this the question given
And here is the question given
Create a class template for a class that holds an object and the number of data elements in the object. For example, if an Employee class has two data elements, an ID number and a salary, then the class template holds the number 2 and an Employee object; if a Student class contains 12 data elements, then the class template holds 12 and a Student object. Write the code for standard input function for the object that displays a message on the screen – “You will be ask to enter X items” – where X is the number of data elements. Write a main() function that tests your template class with an integer and two programmer-defined classes

am i doing correctly until now?

Спасибо: 0 
ПрофильЦитата Ответить
Ответов - 34 , стр: 1 2 All [только новые]


Ответов - 34 , стр: 1 2 All [только новые]
Ответ:
1 2 3 4 5 6 7 8 9
большой шрифт малый шрифт надстрочный подстрочный заголовок большой заголовок видео с youtube.com картинка из интернета картинка с компьютера ссылка файл с компьютера русская клавиатура транслитератор  цитата  кавычки моноширинный шрифт моноширинный шрифт горизонтальная линия отступ точка LI бегущая строка оффтопик свернутый текст

показывать это сообщение только модераторам
не делать ссылки активными
Имя, пароль:      зарегистрироваться    
Тему читают:
- участник сейчас на форуме
- участник вне форума
Все даты в формате GMT  3 час. Хитов сегодня: 5
Права: смайлы да, картинки да, шрифты да, голосования нет
аватары да, автозамена ссылок вкл, премодерация откл, правка нет