CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: 2kaud

Search: Search took 0.10 seconds.

  1. Replies
    17
    Views
    16,489

    Re: Classes and Constructors

    yes - and then introduce it :) There's also #pragma once that can be used with compilers such as VS - which IMO is more elegant if supported.



    Yes :)



    Definitely! :thumb:
  2. Replies
    17
    Views
    16,489

    Re: Classes and Constructors

    How are you learning c++? What book(s), if any, are you using?

    Have at look at this thread http://forums.codeguru.com/showthread.php?231039-C-General-What-are-good-books-about-C and in particular...
  3. Replies
    17
    Views
    16,489

    Re: Classes and Constructors

    Whilst knowledge of separate compilation units and include-guards is important, IMO it's not something that should be introduced early into a newbie c++ course. There's plenty of other good c++ stuff...
  4. Replies
    17
    Views
    16,489

    Re: Classes and Constructors

    Ok. Here's your starter for 10. This will create and display the class instances for the required constructors.



    #include <iostream>
    #include <string>

    struct Name {
    std::string firstName;...
  5. Replies
    17
    Views
    16,489

    Re: Classes and Constructors

    Student::Student(Student& Name student_name, int id_number, std::string student_department, Year students_current_year)


    You haven't specified a class constructor in the class definition. It was...
  6. Replies
    17
    Views
    16,489

    Re: Classes and Constructors

    void displayStudent(Student);


    That is a function declaration in main()?? :confused:

    The class getters should be const.



    Student::student()
  7. Replies
    17
    Views
    16,489

    Re: Classes and Constructors

    I agree re testing and step-wise enhancement. However, first you design the program, then code against the design. IMO the worst thing that programmers can do (especially newbies) is to start coding...
  8. Replies
    17
    Views
    16,489

    Re: Classes and Constructors

    year is an enum and not an int. As per the notes, the enum definition needs to go before the class definition.

    You don't usually put using namespace in a header file as this isn't considered good...
Results 1 to 8 of 8





Click Here to Expand Forum to Full Width

Featured