I'm just messing around a little bit, trying to understand pointers and where they are used in C++ to increase program speed and efficiency. Basically trying to compare similar algorithms in C++ using pointers with their C#/Java counterpart.

My problem is when I'm attempting to print out the Book title from the array. I'm guessing I'm doing something wrong when using the string library. So, here is what I've got right now:

Book.h
Code:
#pragma once

#include <iostream>
#include <string>

using namespace std;

class Book
{
public:
	Book(void);
	~Book(void);

	string getTitle();
	void setTitle(string title);

	int getReleaseYear();
	void setReleaseYear(int releaseYear);
private:
	string title;
	int releaseYear;
};
Book.cpp
Code:
#include "Book.h"

Book::Book(void) {}
Book::~Book(void) {}

string Book::getTitle()
{
	return Book::title;
}

void Book::setTitle(string title)
{
	Book::title = title;
}

int Book::getReleaseYear()
{
	return Book::releaseYear;
}

void Book::setReleaseYear(int releaseYear)
{
	Book::releaseYear = releaseYear;
}
CppArray.cpp
Code:
#include <iostream>
#include "Book.h"

using namespace std;

int main()
{
	const int size = 10;
	Book *b;
	Book books[size];

	for( int i = 0; i < size; i++ )
	{
		b = &books[i];
		b->setTitle("Title " + i);
		b->setReleaseYear(i);
	}

	for( int x = 0; x < size; x++ )
	{
		b = &books[x];
		cout << "Title: " << b->getTitle() << "\t" << "Release Year: " << b->getReleaseYear() << "\n";
	}

	delete b;

	cin.get();
	return 0;
}