• defines a class named Publication whose data members are title and medium and (the data item
medium should be initialized to the word paper The class’s operations are get title() and get medium().
• defines a class named Report that inherits all the properties of the Publication class and adds its
own data item named institute and data operation get institute()
• defines a third class named FTP (File Transfer Protocol), that inherits all the properties of the
class Report and adds its own data items site and medium and data operations get site() and
get medium().
• defines the function get medium()
• creates an object of the class FTP that changes the medium from paper to computer.
When I compile the programme I get the following errors and I'm not really sure what they mean:
strings.cpp:20: error: ‘Report’ has not been declared
strings.cpp:21: error: expected unqualified-id before ‘{’ token
strings.cpp:28: error: ‘FTP’ has not been declared
strings.cpp:29: error: expected unqualified-id before ‘{’ token
strings.cpp: In function ‘int main()’:
strings.cpp:42: error: no match for ‘operator<<’ in ‘std::cin << new_medium’
strings.cpp:43: error: ‘Public’ was not declared in this scope
student@pc533:~/Desktop/shared-folder$ g++ -o strings strings.cpp
strings.cpp:20: error: ‘Report’ has not been declared
strings.cpp:20: error: expected unqualified-id before ‘)’ token
strings.cpp:28: error: ‘FTP’ has not been declared
strings.cpp:29: error: expected unqualified-id before ‘{’ token
strings.cpp: In function ‘int main()’:
strings.cpp:42: error: no match for ‘operator<<’ in ‘std::cin << new_medium’
strings.cpp:43: error: ‘Public’ was not declared in this scope
ANd the code is as follows
# include <iostream>
# include <string>
using namespace std;
class Publication
{
public:
string get_medium();
string get_title();
private:
string medium;
string tilte;
};
class Report::Publication()
{
private:
string institute;
public:
string get_institute();
};
class FTP::Report
{
private:
string medium;
string site;
public:
string get_site();
string get_medium();
};
int main()
{
string new_medium;
cout <<"Enter the name of the new medium "<<endl;
cin <<new_medium;
cout<< Public.get_medium(new_medium);
};
MOD EDIT: Added code tags. When posting code...USE CODE TAGS!!!
This post has been edited by JackOfAllTrades: 03 March 2012 - 03:49 AM

New Topic/Question
Reply



MultiQuote




|