#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std ;
class Student
{
public :
Student( )
{
cout << "Конструируем Student" << endl ;
semesterHours = 0 ;
gpa = 0.0 ;
}
/* ...прочие открытые члены... */
protected :
int semesterHours ;
float gpa ;
} ;
int main ( int nNumberofArgs , char* pszArgs[ ] )
{
setlocale ( LC_ALL , ".1251" ) ; /* печать кириллицы */
cout << "Создание нового объекта Student" << endl ;
Student s ;
cout << "Создание нового объекта Student в куче" << endl ;
Student* pS = new Student ;
/* Пауза для того, чтобы посмотреть на результат работы программы */
system( "PAUSE" ) ; return 0 ;
}
_________________
190 стр. Часть 3. Введение в классы