Search:

Type: Posts; User: mannu1200

Search: Search took 0.00 seconds.

  1. Replies
    11
    Views
    3,615

    how to prevent encapsulation in c++ ?

    using pointers this program is violating encapsulation rule-



    class MyClass
    {
    int i;
    public:
    int j;
    MyClass(int temp1,int temp2){i=temp1;j=temp2;}
  2. Do C compliers make "frequently called function" an inline function automatically?

    So the question is -




    //will this code runs slower-
    for (int i = 0; i < strlen(str); i++)
    {......}

    //compare to this-
  3. Yes I know that but still i was trying to...

    Yes I know that but still i was trying to understand the fundamentals.....
  4. okae it will stored in stack while function...

    okae it will stored in stack while function calling but in the 2nd case it will get stored in stack as well as in memory....
    now i think it will save memory
  5. i think it doesnt for supporting my answer-...

    i think it doesnt
    for supporting my answer-
    when we pass a string like this-
    abcd("hello");
    instead of-
    char *str = "hello";
    abcd(str);

    it still get stored in the memory and the base address...
  6. Do calling method inside printf saves memory?

    My question is simple..
    so will this code save an integer memory ?



    printf("%d",abcd());


    //compare to-
Results 1 to 6 of 6