sâmbătă, 25 ianuarie 2014

C++ 11 FEATURES

Non-static data member initializers
http://msdn.microsoft.com/en-us/library/hh567368.aspx
1.
#include <iostream>

class A {
    public:
        int a = 7;
    };
 void main(){
        A a;
std::cout<< a.a;
}

--Visual Studio 2012 - nu suporta initializarea variabilei membre
Error 1 error C2864: 'A::a' : only static const integral data members can be initialized within a class



Vs 2013 OK

2.Initializer lists
class A {
public:
A(int a)
{
this->a = a;
}
int a = 7;
};
void main()
{
A a{ 8 };//  {} instead of ()
std::cout<< a.a;
}






Books for Microsoft .NET Certification

MCTS Self-Paced Training Kit (Exam 70-511): Windows Applications Development with Microsoft® .NET Framework 4

http://www.microsoft.com/learning/en-us/book.aspx?id=14321

MCTS Self-Paced Training Kit (Exam 70-515): Web Applications Development with Microsoft® .NET Framework 4

http://www.amazon.com/MCTS-Self-Paced-Training-Exam-70-515/dp/0735627401

Call function from DLL

Native dll function call C++

 typedef __DLL_FUNCTION bool PMyFUNCT (const wchar_t* szCon, const wchar_t* szName); HINSTANCE lib; void myMethod(const wchar_t* szCon, const wchar_t* szName) 

    int lastError = 0; bool bSaved = false; lib = LoadLibrary("mylib.dll"); if(lib) { // Get the address of the function         PMyFUNCT *cFunction; cFunction = ( PMyFUNCT *)GetProcAddress(lib, "_myFunct"); if(cFunction) { cFunction(szCon, szName); } } }
News in .NET 4.5
What's New in the .NET Framework 4.5 - http://msdn.microsoft.com/en-us/library/ms171868(v=vs.110).aspx  




C++

C++ 11 - standard  http://en.wikipedia.org/wiki/C%2B%2B11

Support for C++ Features in Visual Studio 2012/2013

http://msdn.microsoft.com/en-us/library/hh567368.aspx

Ex. Variadic_templates

template <typename... BaseClasses> class ClassName : public BaseClasses... {
public:

ClassName(BaseClasses&&... base_classes) : BaseClasses(base_classes)... {}
};



Intrebare din test tehnic - interviu - C#

Ce afiseaza acest program?


    class Point
    {
        internal int x = 1;
        internal int y = 1;

        public Point() :this(0, 0)
        {
            x = 0;
            y = 0;
        }
        public Point(int x, int y)
        {
            this.x = x;
            this.y = y;
        }
    }

        class Line: Point
        {
           protected Point p;
   

            public Line (int x, int y)
            {
                p = new Point();
                p.x = x;
                p.y = y;
            }

            public int GetLength()
            {
                return (int)Math.Sqrt((x - p.x)*(x - p.x) + (y - p.y) * (y - p.y));
            }


        }


        struct structuraMea
        {
            int x;

            public int X
            {
                get { return x; }
                set { x = value; }
            }
            int GetVal()
            {
                return x;
            }

        }

   
     class Program
    {
         static void Change(ref structuraMea s)
         {
             s.X = 2;
         }
        static void Main(string[] args)
        {
            structuraMea t = new structuraMea();
            t.X = 1;
            Change(ref t);

     
            string s1 = "text";
            string s2 = s1.ToString();
            System.Console.WriteLine(s1 == s2);
            System.Console.WriteLine((object)s1 == (object)s2);
         

            Line line = new Line(2, 2);
            System.Console.WriteLine(line.GetLength());
            System.Console.ReadLine();
        }

Raspuns: True, True, 2


--raspuns True, True, 2