Click here to Skip to main content
15,918,889 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Excel automation compatibility problem Pin
vikas amin31-Jul-08 11:34
vikas amin31-Jul-08 11:34 
Questionexe name Pin
sunit531-Jul-08 0:30
sunit531-Jul-08 0:30 
AnswerRe: exe name Pin
sunit531-Jul-08 2:27
sunit531-Jul-08 2:27 
AnswerRe: exe name Pin
Randor 31-Jul-08 10:17
professional Randor 31-Jul-08 10:17 
GeneralRe: exe name Pin
sunit531-Jul-08 18:37
sunit531-Jul-08 18:37 
QuestionProblem with friend keyword Pin
T.RATHA KRISHNAN30-Jul-08 23:39
T.RATHA KRISHNAN30-Jul-08 23:39 
AnswerRe: Problem with friend keyword Pin
CPallini30-Jul-08 23:49
mveCPallini30-Jul-08 23:49 
GeneralRe: Problem with friend keyword Pin
T.RATHA KRISHNAN30-Jul-08 23:56
T.RATHA KRISHNAN30-Jul-08 23:56 
Sorry. It's advised by my organisation not to post original code. Here is the modified post:

Hi!
I've two unrelated classes named "character" and "test". I've defined a variable "flag" inside test. I've to access this variable from the other class(i.e from "character"). For this I've declared the class "character" as friend in test.h in the private section.
i.e

<pre>friend class character;</pre>

and I've also forward declared the class test in character like this:

<pre>class test;</pre>

I've used the following code to access the variable:

<pre> test friend_test = new test();
friend_test-&gt;char_flag1 = false;</pre>

But it shows the following errors:

(i)error C2079: 'friend_test' uses undefined class 'test'
(ii)error C2512: 'test' : no appropriate default constructor available
(iii) left of '-&gt;char_flag1' must point to class/struct/union/generic type

Is there any other way to access a variable which is declared inside some other class?
GeneralRe: Problem with friend keyword Pin
CPallini31-Jul-08 0:03
mveCPallini31-Jul-08 0:03 
GeneralRe: Problem with friend keyword Pin
T.RATHA KRISHNAN31-Jul-08 0:11
T.RATHA KRISHNAN31-Jul-08 0:11 
GeneralRe: Problem with friend keyword Pin
CPallini31-Jul-08 0:17
mveCPallini31-Jul-08 0:17 
GeneralRe: Problem with friend keyword Pin
T.RATHA KRISHNAN31-Jul-08 0:21
T.RATHA KRISHNAN31-Jul-08 0:21 
GeneralRe: Problem with friend keyword Pin
CPallini31-Jul-08 0:36
mveCPallini31-Jul-08 0:36 
GeneralRe: Problem with friend keyword Pin
David Crow31-Jul-08 5:36
David Crow31-Jul-08 5:36 
QuestionUSB Size [modified] Pin
mirtu30-Jul-08 23:13
mirtu30-Jul-08 23:13 
AnswerRe: USB Size Pin
CPallini30-Jul-08 23:46
mveCPallini30-Jul-08 23:46 
GeneralRe: USB Size Pin
Iain Clarke, Warrior Programmer30-Jul-08 23:53
Iain Clarke, Warrior Programmer30-Jul-08 23:53 
GeneralRe: USB Size Pin
CPallini31-Jul-08 0:00
mveCPallini31-Jul-08 0:00 
AnswerRe: USB Size Pin
Iain Clarke, Warrior Programmer30-Jul-08 23:52
Iain Clarke, Warrior Programmer30-Jul-08 23:52 
AnswerRe: USB Size Pin
Perspx30-Jul-08 23:54
Perspx30-Jul-08 23:54 
AnswerRe: USB Size Pin
mirtu31-Jul-08 0:21
mirtu31-Jul-08 0:21 
AnswerRe: USB Size Pin
Iain Clarke, Warrior Programmer31-Jul-08 0:42
Iain Clarke, Warrior Programmer31-Jul-08 0:42 
GeneralRe: USB Size Pin
mirtu31-Jul-08 0:54
mirtu31-Jul-08 0:54 
GeneralRe: USB Size Pin
mirtu1-Aug-08 18:10
mirtu1-Aug-08 18:10 
QuestionMS SQL Server/C++ Pin
Rob Caldecott30-Jul-08 21:24
Rob Caldecott30-Jul-08 21:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.