Click here to Skip to main content
14,690,616 members
Home » Discussions » Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: Convert From c# - For Report Viewer Report save as PDF format Pin
John Schroedl17-Jun-15 9:39
professionalJohn Schroedl17-Jun-15 9:39 
GeneralRe: Convert From c# - For Report Viewer Report save as PDF format Pin
Paramu197317-Jun-15 16:07
MemberParamu197317-Jun-15 16:07 
QuestionOOP - Error | Unhandled exception at 0x0FD2CCC8 (msvcp110d.dll) Pin
Member 1164129910-Jun-15 3:23
MemberMember 1164129910-Jun-15 3:23 
QuestionRe: OOP - Error | Unhandled exception at 0x0FD2CCC8 (msvcp110d.dll) Pin
Richard MacCutchan10-Jun-15 22:32
mveRichard MacCutchan10-Jun-15 22:32 
QuestionEnabling ListControl pane in MFC (C++) Pin
Yateesh KR12-May-15 23:14
MemberYateesh KR12-May-15 23:14 
QuestionRe: Enabling ListControl pane in MFC (C++) Pin
Richard MacCutchan13-May-15 3:55
mveRichard MacCutchan13-May-15 3:55 
QuestionInheritance tricky question Pin
Amrit Agr12-May-15 10:30
MemberAmrit Agr12-May-15 10:30 
AnswerRe: Inheritance tricky question Pin
Sascha Lefèvre12-May-15 12:38
professionalSascha Lefèvre12-May-15 12:38 
myBar[1].i is still 0. The problem here is that you try to apply pointer-arithmetic to a base-class pointer. When you add 1 to Foo* obj in the loop in display(..), the pointer is increased by the size of Foo, because it's declared as a pointer to Foo. But it's actually (initially) pointing to instances of Bar, whose size is larger than that of Foo - so after adding 1 to the pointer, it points to some address still within the first instance of Bar, not to the second Bar. The output of 1 is whatever happens to be at the address where i should be if the pointer was valid.

The closest thing you can do to make it work is to use pointers to pointers:
void display2(Foo** obj, int ctr)
{
    for (int i = 0; i < ctr; i++)
    {
        (*(obj + i))->geti();
    }
}

int _tmain(int argc, _TCHAR* argv[])
{
    Foo myFoo[3];
    display(myFoo, 3);

    Bar myBar[3];
    Foo *myBaz[3] = { &myBar[0], &myBar[1], &myBar[2] };
    display2(myBaz, 3);

    return 0;
}

If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

GeneralRe: Inheritance tricky question Pin
Amrit Agr13-May-15 8:47
MemberAmrit Agr13-May-15 8:47 
AnswerRe: Inheritance tricky question Pin
Sascha Lefèvre13-May-15 10:12
professionalSascha Lefèvre13-May-15 10:12 
Questionenglish language implementation Pin
Member 936602117-Apr-15 4:58
professionalMember 936602117-Apr-15 4:58 
AnswerRe: english language implementation Pin
Member 936602117-Apr-15 5:00
professionalMember 936602117-Apr-15 5:00 
Questionmultiple Pin
memoarfaa16-Apr-15 2:28
Membermemoarfaa16-Apr-15 2:28 
GeneralRe: multiple Pin
Richard MacCutchan16-Apr-15 3:20
mveRichard MacCutchan16-Apr-15 3:20 
QuestionHow to swap address of pointers of 2 variables without using a temporary variable? Pin
Amrit Agr13-Apr-15 21:36
MemberAmrit Agr13-Apr-15 21:36 
AnswerRe: How to swap address of pointers of 2 variables without using a temporary variable? Pin
jschell14-Apr-15 14:17
Memberjschell14-Apr-15 14:17 
AnswerRe: How to swap address of pointers of 2 variables without using a temporary variable? Pin
zhijzan7-Jun-15 21:40
Memberzhijzan7-Jun-15 21:40 
AnswerRe: How to swap address of pointers of 2 variables without using a temporary variable? Pin
Shao Voon Wong28-Jun-15 23:13
mvaShao Voon Wong28-Jun-15 23:13 
Questionhow to migrate CORBA to Web Service in C++ Pin
VC_RYK13-Apr-15 21:20
MemberVC_RYK13-Apr-15 21:20 
Questionconsumer.C: In function âint main(int, char**)â: consumer.C:69: error: invalid conversion from âvoid (*)(buffer_t*, char)â to âvoid* (*)(void*)â consumer.C:69: error: initializing argument 3 of âint pthread_create(pthread_t*, const pthread_attr_t*, Pin
Member 1160464113-Apr-15 16:29
MemberMember 1160464113-Apr-15 16:29 
AnswerRe: consumer.C: In function âint main(int, char**)â: consumer.C:69: error: invalid conversion from âvoid (*)(buffer_t*, char)â to âvoid* (*)(void*)â consumer.C:69: error: initializing argument 3 of âint pthread_create(pthread_t*, const pthread_attr Pin
Richard MacCutchan13-Apr-15 22:33
mveRichard MacCutchan13-Apr-15 22:33 
Questionint **p = (int**)new int(5); Confusing !!! Pin
Amrit Agr5-Apr-15 9:32
MemberAmrit Agr5-Apr-15 9:32 
AnswerRe: int **p = (int**)new int(5); Confusing !!! Pin
Richard Andrew x645-Apr-15 11:14
professionalRichard Andrew x645-Apr-15 11:14 
AnswerRe: int **p = (int**)new int(5); Confusing !!! Pin
Zabir Al Nazi Nabil5-Apr-15 12:34
professionalZabir Al Nazi Nabil5-Apr-15 12:34 
Questionsolitaire game Pin
Member 115602925-Apr-15 5:19
MemberMember 115602925-Apr-15 5:19 

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.