•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 456,564 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,578 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 2832 | Replies: 2
![]() |
•
•
Join Date: Aug 2004
Posts: 13
Reputation:
Rep Power: 5
Solved Threads: 0
Hi
I made a class that has a public integer pointer
and I use this pointer in main like code below: (Just a sample code,I know about memory leaks and other related bugs,just a sample)
#include<iostream.h>
class Cat
{
public:
int *Pointer;
};
main()
{
Cat *pCat;
pCat=new Cat;
pCat->Pointer = new int;
pCat->*Pointer=34 //this makes a compiler error
delete pCat->Pointer;
return 0;
}
I need to access this(Pointer) public pointer of class cat directly not from class methods;
I made a class that has a public integer pointer
and I use this pointer in main like code below: (Just a sample code,I know about memory leaks and other related bugs,just a sample)
#include<iostream.h>
class Cat
{
public:
int *Pointer;
};
main()
{
Cat *pCat;
pCat=new Cat;
pCat->Pointer = new int;
pCat->*Pointer=34 //this makes a compiler error
delete pCat->Pointer;
return 0;
}
I need to access this(Pointer) public pointer of class cat directly not from class methods;
![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Private Access (C++)
- Pointer to a data member (C++)
- Tiffiney Needs Help!! PLEASE! WITH C++ (C++)
- Any Java Source for 16 Questions (Java)
- accessing private data members (C++)
- Classes (C++)
Other Threads in the C++ Forum
- Previous Thread: functions
- Next Thread: Why can't I use Pointers to point to a Enumurated Constant


Linear Mode