Search Results

Search found 4 results on 1 pages for 'poiuyt'.

Page 1/1 | 1 

  • C++ inheritance: scoping and visibility of members

    - by Poiuyt
    Can you explain why this is not allowed, #include <stdio.h> class B { private: int a; public: int a; }; int main() { return 0; } while this is? #include <stdio.h> class A { public: int a; }; class B : public A{ private: int a; }; int main() { return 0; } In both the cases, we have one public and one private variable named a in class B. edited now!

    Read the article

  • Object allocation in C++

    - by Poiuyt
    char *myfunc() { char *temp = "string"; return temp; } In this piece of code, where does the allocation of the object pointed to by temp happen and what would be its scope? Is this function a valid way to return a char* pointer?

    Read the article

  • C++ inheritance doubt

    - by Poiuyt
    Can you explain why this is not allowed, #include <stdio.h> class B { private: int a; public: int a; }; int main() { return 0; } while this is? #include <stdio.h> class A { public: int a; }; class B : public A{ private: int a; }; int main() { return 0; } In both the cases, we have one public and one private variable named a in class B.

    Read the article

  • Is there any difference these two pieces of code?

    - by Poiuyt
    #include<stdio.h> class A {public: int a; }; class B: public A {private: int a;}; int main(){ B b; printf("%d", b.a); return 0; } #include<stdio.h> class A {public: int a; }; class B: private A {}; int main(){ B b; printf("%d", b.a); return 0; } I ask because I get different errors: error: 'int B::a' is private error: 'int A::a' is inaccessible Apart from what the errors might reveal, is there any difference at all in the behaviour of these two pieces of code?

    Read the article

1