need u r help

what the problem with this code?
it says is error C2511: 'void publication::printData(void) const' : overloaded member function not found in 'publication'for each print in both class .

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 #include<iostream>
#include<string>
#include"q2.h"
using namespace std;

publication::publication(){title =""; price=0; }                   
publication::publication(string t, float p){ title=t; price=p;} 
void publication::setData(){
      cout << "Enter title: "<<endl; 
      cin >> title;
      cout << "Enter price: "<<endl ; 
      cin >> price;
}
 void publication::printData()const{
      cout << "Title: " << title<<endl;
      cout << "Price: " << price<<endl;
}

Book::Book(string t,float p,int b):publication(t,p),page_count(b){}
void Book::setData(){
publication::setData();
cout<<"\nEnter the page count\n";
cin>>page_count;
}
void Book::printData(){
publication::printData();
cout<<"Pagecount is:"<<page_count;
}
Hi,
maybe your prototype of printData() function in "q2.h" is not same as this one,
check them, and if you still have this problem, please post "q2.h" codes too.
Topic archived. No new replies allowed.