English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

this is the code:
#include
#include
int count=0;
class obj{
public :
obj();
~obj();
};
obj() {
++count;
cout< }
~obj(){
--count;cout< }
int main(){
obj A;

cout<<"begin block "< obj B;
cout<<"end block"<
return 0;
}
where is the error? can someone point it out for me?
your help will be greatly appreciated.
best regards.

2006-10-24 00:54:32 · 1 answers · asked by samurai 1 in Computers & Internet Programming & Design

1 answers

The error is when you define the constructor obj() and destructor
~obj(). Since you are defining the constructor and desctructor outside the class declaration, you need to use scope resolution like shown below.Else you will get compile error.
obj::obj(){
++count;
cout< }

obj::~obj(){
--count;cout< }

2006-10-25 06:22:06 · answer #1 · answered by RajMirage 2 · 0 0

fedest.com, questions and answers