inheritance (please help)

2012-07-28  Source: Original Site  Category:Visual C++  Views:0 


please help. could someone tell me why when i run my code (below) it skips cin.getline for the instructor name? but when i place the Regular one outside the for loop it works fine.

class Instructor
char name[25];
char date_hired[15];
double salary_rate;
double hours;
void display();
Instructor::Instructor(){ }
void Instructor::display()
cout<<"Regular Instructor Info"<<endl;
cout<<"Name: "<<name<<endl;
cout<<"Date of Hire: "<<date_hired<<endl;
cout<<"Salary_rate: "<<salary_rate<<endl;
cout<<"Hours worked: "<<hours<<endl;
class Regular : public Instructor
Regular::Regular() : Instructor()
hours = 15;
cout<<"Enter instructor name, followed by return: ";
cout<<"Enter instructor date of hire, followed by return: ";
cout<<"Enter Regular Instructor salary_rate, followed by return: ";
void main()
Instructor *ptr;
ptr = new Instructor[3];

for (int i=0;i<3;i++)
int x=0;
cout<<"- select a type of instructor -"<<endl<<endl;
cout<<"1. REGULAR INSTRUCTOR "<<endl;

cout<<"please type in your selection (1-3): ";

Regular one;
ptr[i] = one;

Related articles
  • inheritance (please help) 2012-07-28

    please help. could someone tell me why when i run my code (below) it skips cin.getline for the instructor name? but when i place the Regular one outside the for loop it works fine. class Instructor { protected: char name[25]; char date_hired[15]; dou

  • again having problem about inheritance please help 2012-10-03

    When I compile the code below it generates more than 30 syntax errors. It does not make sense. The problem is probably somewhere in Patient(string name_of_patient, int age_of_patient, string address_of_pat, double visit_duration_ofp, string ssn_of_pa

  • MessageBox.Show inherited strings. please help 2014-03-30

    Serious migraine, please help me :D Im working on homework, and my assignment was to write a basic Windows App that had txt boxes for username, password, confirm password (though at the moment it doesnt actually have to check if pass and confirm are

  • Error C2248 .. please help 2012-10-14

    Im implementig inheritance in my current project and end up with a the C2248 error. Relevant Code: First my Tower.h from which I want to inherit a class "Plasmatower" #ifndef TOWER_H_INCLUDED #define TOWER_H_INCLUDED #include "Ogre.h" using namespace

  • How to Embed Windows Form ActiveX Control in HTML Page? O! Please Help. 2012-11-17

    Can Some Body Correct My Code, I want to Create ActiveX Control and Embed it in a HTML Page. Currently, it doesn't diplay the Control on the form. In VB6 I used to come up with .OCX file but here, I just can't get it. Please help me out, I need this

  • simple cash register (pos) problem - please help!! 2012-12-10

    every1! Im a newbie to vb.Net and i have done my best to workout a solution for this challenge but i keep hitting walls. i would appreciate it if some1 could help me with it, thanks in advance!! My application is 99% complete except for this 1 proble

  • Ubuntu Someone Please Help Me With Zussaweb 2013-01-25

    Could someone please help me with the issue I am having in getting Zussaweb to work with my Hellanzb? I have Hellanzb working and it is fine does what it is supposed to do. For the life of me I can't seem to get it and Zussaweb to work with each othe

  • fstream problem--please help 2013-03-19

    In a class (say class 1), I had a data member of type fstream. I changed the type from fstream to a class I wrote, which inherits from fstream and adds some new functions. In my program, when deleting "class 1", I got the following debug error: Damag

  • AJAX Not Working In IE--Please Help 2013-06-17

    I inherited a piece of AJAX code, which works in Firefox, Opera, and Safari, but not in IE. Unfortunately, I'm not fluent enough in AJAX to be able to effectively troubleshoot the problem. Could someone please take a look at my code and help me get i

  • Please help me to convert a simple C++ program into an object-oriented one. 2013-09-09

    I’ve been given told to convert a standard C++ program into an object-oriented one, using the principals of polymorphism, encapsulation and inheritance. Our lecturer covered all three principals in one 45 minute slot. I’m completely stuck and would b

  • Overriding control events PLEASE HELP 2014-01-11

    I have a class named MonthView that inherits the MonthCalendar control. I'm trying to get the MonthView to recognize certain events. For example, when the dateChange event is called, how do i get the class to recognize this event has been triggered a

  • Please Help!--How to attach a new view to a document? 2014-03-06

    What I want to do is: I designe a new view class (inherited from cview), then how can I open this view window and attach it to some document? ...Please help me..

  • Problem with MFC Dialog, Please Help !! 2014-12-16

    :wave: All, I am making one dialog in MFC by inheriting it from CDialog. I want that whenever this dialog is opened, Escape key should be disabled. I want to disable Escape Key on this dialog. Is it possible in any way? Please help me to do this. Tha

  • Please Help me ! its Very urgent 2014-12-29

    I need to create an ActiveX control , that will run on IE (internet Explorer). Could you please guide me on following issues 1) How can I create the ActiveX control in VB.NET and Deploy it . 2) Due to the rich features of VB.NET like inheritance , we

  • Please Help with Add, Delete, Edit and Update Record Plz 2015-01-19

    I have created simple database project, using,, oledb, datatable, datagridview. My program is working nice, I just need Help with how to add, delete, update and edit records. Can any one please and please help me in this case, or can p

  • hi please help me 2015-04-13

    i want to inherite a value from one class variable to another class variable and assign in tht one. whenever the value changes in the main class the inheriated class value should be changed. eg: class A{ int x=5;} classB{ int y=x; } how can we do tha

  • Hijacked computer PLEASE HELP XADSQ 2015-04-21

    Please help me. I only just learned what Hijacking is. I inherited this computer and it seems to have a lot of pop-ups and XXXdialer stuff on it. I could delete them though Hijackthis if I only knew which ones to delete. My log is as follows: Logfile

  • C++ Inheritance [need help] 2015-04-21

    Could somebody please help me in this C++ program? I'm a beginner and have no idea doing this tutorial. anyone who could help me would be greatly appreciated. here is the question: Create an inheritance hierarchy that a bank might use to represent cu

  • HTML Forms, Please Help me 2012-01-01

    Hi I nead your help. I´m trying to open a page when I press a button and have data from the forms textbox to be accessible int the new form by hidden field´s. Perhaps not best or?? I wounder if you can have two forms in one <html>, se below. Wh

  • Oracle ORDDoc - Loading Word Document - Please Help 2012-01-01

    Hi I am trying to upload the word document (doc format) to the table i have in oracle database. The table has the column of type OrdDoc. I am using Intermedia Java API to load the word file from my local system to the database. The upload is happenin