dynamic allocation of Date class

Posted on 2005-04-23
Last Modified: 2010-04-01
Sup all,

I've just been messing around with pointers declaring dynamic classes, but cant get it to use the member functions.

Eg, i can have:

Date  Test(1,4,2005);

which will print out the date info fine, but cannot get:

      Date  *dptr = new Date(1,4,2005);
I haven't done much on pointers for a while so please excuse me if I have made some schoolboy errors.


Question by:David_4321
    LVL 37

    Accepted Solution

    Hi David_4321,

    LVL 37

    Assisted Solution

    by:Harisha M G
        -> (Arrow) operator should be used while accessing the members through a pointer.
        . (Dot) operator should be used while accessing them directly

    Author Comment

    silly me, thank you

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Suggested Solutions

    When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
    Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
    The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
    The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

    734 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

    21 Experts available now in Live!

    Get 1:1 Help Now