Hi!
I'm trying to write a very very simple program, that includes a simple class. A book object with one classdata. but the compiler just gives errors and I cant find whats wrong , can anyone help me.
////////////////////////////////////////////////
main file
////////////////////////////////////////////////
#include <iostream>
#include "TBook.h"
using namespace std;
int main() {
return 0;
////////////////////////////////////////////////
TBook.h
///////////////////////////////////////////////
#ifndef TBOOK_H
#define TBOOK_H
#include <string>
class TBook
{
public:
TBook(string title);
string GetTitle();
private:
const string Title;
};
#endif
////////////////////////////////////////////////////////////
TBook.cpp
////////////////////////////////////////////////////////////
#include "TBook.h"
Book::Book(string title);
: Title(title),
{
}
string Book::GetTitle() {
return Title;
}
////////////////////////////////////////////////////////////
xcode just gives me error when I try to compile the code.
TBook.h:19: error: expected `)' before "title"
TBook.h:20: error: 'string' does not name a type
TBook.h:25: error: 'string' does not name a type
What am I doing wrong???
I'm trying to write a very very simple program, that includes a simple class. A book object with one classdata. but the compiler just gives errors and I cant find whats wrong , can anyone help me.
////////////////////////////////////////////////
main file
////////////////////////////////////////////////
#include <iostream>
#include "TBook.h"
using namespace std;
int main() {
return 0;
////////////////////////////////////////////////
TBook.h
///////////////////////////////////////////////
#ifndef TBOOK_H
#define TBOOK_H
#include <string>
class TBook
{
public:
TBook(string title);
string GetTitle();
private:
const string Title;
};
#endif
////////////////////////////////////////////////////////////
TBook.cpp
////////////////////////////////////////////////////////////
#include "TBook.h"
Book::Book(string title);
: Title(title),
{
}
string Book::GetTitle() {
return Title;
}
////////////////////////////////////////////////////////////
xcode just gives me error when I try to compile the code.
TBook.h:19: error: expected `)' before "title"
TBook.h:20: error: 'string' does not name a type
TBook.h:25: error: 'string' does not name a type
What am I doing wrong???