Building a CMS with PHP part 6 Creating Tables in phpmyadmin
Building a CMS with PHP part 6 Creating Tables in phpmyadmin
Building a CMS with PHP part 6 Creating Tables in phpmyadmin
Think Twice ... Code Once
I would advise folks in software to do one thing, and that’s write. Learn how to write ... It’s actually useful. You need to know how to express yourself. And it’s really tough for a lot of engineers to step up and do public speaking... Once you create a successful piece of software, you’re probably going to be writing English as much as you’re going to be writing Java or Objective C. I’ve created multiple pieces of software at DocuSign that went viral, and people liked them and wanted to use more of them. And I probably wrote 10 times the documentation and explanation, and answered questions in paragraph form.
- //1. Declaration
- public delegate int MyDelagate(int a, int b); //delegates having same signature as method
- public class Example
- {
- // methods to be assigned and called by delegate
- public int Sum(int a, int b)
- {
- return a + b;
- }
- public int Difference(int a, int b)
- {
- return a - b;
- }
- }
- class Program
- {
- static void Main()
- {
- Example obj = new Example();
- // 2. Instantiation : As a single cast delegate
- MyDelagate sum = new MyDelagate(obj.Sum);
- MyDelagate diff = new MyDelagate(obj.Difference);
- // 3.Invocation
- Console.WriteLine("Sum of two integer is = " + sum(10, 20));
- Console.WriteLine("Difference of two integer is = " + diff(20, 10));
- }
- }
- /* Out Put
- Sum of two integer is = 30
- Difference of two integer is = 10
- */
- //1. Declaration
- public delegate void MyDelagate(int a, int b);
- public class Example
- {
- // methods to be assigned and called by delegate
- public void Sum(int a, int b)
- {
- Console.WriteLine("Sum of integers is = " + (a + b));
- }
- public void Difference(int a, int b)
- {
- Console.WriteLine("Difference of integer is = " + (a - b));
- }
- }
- class Program
- {
- static void Main()
- {
- Example obj = new Example();
- // 2. Instantiation
- MyDelagate multicastdel = new MyDelagate(obj.Sum);
- multicastdel += new MyDelagate(obj.Difference);
- // 3. Invocation
- multicastdel (50, 20);
- }
- }
- /* Out put
- Sum of integers is = 70
- Difference of integer is = 30
- */
- public class Example
- {
- public static void Main() //calling method
- {
- int val1 = 0; //must be initialized
- int val2; //optional
- Example1(ref val1);
- Console.WriteLine(val1); // val1=1
- Example2(out val2);
- Console.WriteLine(val2); // val2=2
- }
- static void Example1(ref int value) //called method
- {
- value = 1;
- }
- static void Example2(out int value) //called method
- {
- value = 2; //must be initialized
- }
- }
- /* Output
- 1
- 2
- */
- class MyClass
- {
- public void Method(out int a) // compiler error “cannot define overloaded”
- {
- // method that differ only on ref and out"
- }
- public void Method(ref int a)
- {
- // method that differ only on ref and out"
- }
- }
- class MyClass
- {
- public void Method(int a)
- {
- }
- public void Method(out int a)
- {
- // method differ in signature.
- }
- }