Solved

C++ Homework Help Nested classes

Posted on 2013-05-28
4
291 Views
Last Modified: 2013-06-08
Hi,

Alright 10 minutes into this thing and I am already stuck. I have a class Employee that seems fine, another class Student again fine.

Now I need a class TeachingAssistant nesting the first two classes. Sounds easy:
My header for just getting started:

#ifndef TEACHINGASSISTANT_H
#define TEACHINGASSISTANT_H

#include "Employee.h"
#include "Student.h"

class TeachingAssitant
{
public:
	TeachingAssitant();
	class Employee;
	class Student;
};

#endif

Open in new window


When I go to implement TeachingAssistant it won't see it. I am including the above header file so I am not sure how to get further.

#include "stdafx.h"
#include "TeachingAssisstant.h"

using namespace std;

TeachingAssistant::TeachingAssistant() <- error

Open in new window


Thanks!
0
Comment
Question by:mohrk
  • 2
  • 2
4 Comments
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 39202237
Just a typo. You called the class TeachingAssitant in the .h file (missing an 's')

Also, your include for the .h looks like it has an extra 's'

Everything else looks like it should work.
0
 

Author Comment

by:mohrk
ID: 39202586
I think intellisense would have picked all of that up but I retyped it all to be sure.

"It" doesn't seem to like my constructor for TeachingAssistant. I just compiled and have a ton of errors. I will work through them and post an update. Should have tried that first. The errors are mostly in the other classess and implementations.

Sorry I got frustrated.

Thanks!
0
 
LVL 37

Accepted Solution

by:
TommySzalapski earned 500 total points
ID: 39202645
If you're not already doing this, try compiling much more often. It will save you tons of time if you try compiling every time you write a class definition or function instead of waiting until you have dozens of new lines of code.
0
 

Author Closing Comment

by:mohrk
ID: 39232107
Good tip thanks!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
This is about my first experience with programming Arduino.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now