Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

dynamic allocation of Date class

Posted on 2005-04-23
3
Medium Priority
?
239 Views
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);
      Test.printDate();

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

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

Thanks

David
0
Comment
Question by:David_4321
  • 2
3 Comments
 
LVL 37

Accepted Solution

by:
Harisha M G earned 500 total points
ID: 13851422
Hi David_4321,
    dptr->printDate();

Bye
---
Harish
0
 
LVL 37

Assisted Solution

by:Harisha M G
Harisha M G earned 500 total points
ID: 13851429
David_4321,
    -> (Arrow) operator should be used while accessing the members through a pointer.
    . (Dot) operator should be used while accessing them directly
0
 

Author Comment

by:David_4321
ID: 13851433
silly me, thank you
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

578 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