Hi,
here is my program with the following error when I run it.
I want to make program that can calculate no. of objects but objects are not creating here. whats is the problem and plz resolve it thanks.
Error: ...source.cpp(7): error C2872: 'count' : ambiguous symbol
Code:
////count.h//////
#pragma once
class count
{
public:
count(void);
static int counter;
void print();
~count(void);
};
Code:
////count.cpp////
#include "count.h"
#include<iostream>
using namespace std;
count::count(void)
{
counter++;
}
void count::print()
{
cout<<"No. of Objects: "<< counter;
}
count::~count(void)
{
}
Code:
////source.cpp////
#include<iostream>
#include"count.h"
using namespace std;
void main()
{
count o1, o2, o3;
o1.print();
system("pause");
}