Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

C++ Homework Help Nested classes

Posted on 2013-05-28
4
Medium Priority
?
299 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 2000 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
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 …
Six Sigma Control Plans

609 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