Implementing Signature Block Class

For class we are required to implement a signature block on all our assignments. To do this I've created a Signature Block class, but I'm having trouble implementing it. When I try to compile in Dev C++ I get this error:

[Error] request for member 'toString' in 'myblock', which is of non-class type 'SignatureBlock()'

Here is the code:

Assignment1.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <string>
#include "SignatureBlock.h"

// Assignment 1: Requests user's name and says "Hello."

using namespace std;

int main(int argc, char** argv) {
	string name;				// string to store user's name				
	SignatureBlock myblock();	// create a signature block object
	
	cout << myblock.toString();	// send signature to standard output
	
	cout << "What is your name? ";	// prompt for name
	getline(cin, name);				// store user's name in name variable
	cout << "Hello, " << name << "!" << endl;	// output greeting
	
	return 0;
}


SignatureBlock.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <string>

// Implementation file for SignatureBlock.h class. To be used in all assignments 

// Default Constructor
SignatureBlock::SignatureBlock()
{
	// Assign values to class variables
	name.assign("Leroy Jenkins\n");
	courseID.assign("CIS215\n");
	email.assign("leroyjenkins@gmail.com\n");
}

// toString function to return string representation of the SignatureBlcok
std::string SignatureBlock::toString()
{
	std::string retval;
	
	retval.append(name);
	retval.append(courseID);
	retval.append(email);

	return(retval);
}


SignatureBlock.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <string>

// Header file for class SignatureBlock. To be used in all assignments (CIS 215)

class SignatureBlock
{
	// protected strings to store parts of signature
	protected:
		std::string name;
		std::string courseID;
		std::string email;
	// public functions to access or mutate protected variables
	public:
		SignatureBlock(); // Default Constructor
		std::string toString(); // Accessor
		// In future: could add additional constructors, acessors, and/or mutators
}
;


Thank you for any suggestions.
This does not define an object; it declares a function

1
2
// declare a function named myblock which returns SignatureBlock
SignatureBlock myblock(); // create a signature block object 


This does: SignatureBlock myblock ; // define a signature block object
Thanks for the suggestion, but unfortunately just fixing that did not correct the errors. So, obviously there's a whole lot more wrong with the code. Any other suggestions are certainly welcome.
Is the SignatureBlock.cpp you posted the complete file?

I would have expected to see this line near the top of it:

#include "SignatureBlock.h"

Andy
That was it. Thanks a lot Andy! Guess I should have known that.
Topic archived. No new replies allowed.