Solved

C++ Homework Help Nested classes

Posted on 2013-05-28
4
297 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Progress

717 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