Found 33676 Articles for Programming

Golang Program to Create Abstract Class

Akhil Sharma
Updated on 22-Dec-2022 18:21:48

3K+ Views

In this article, we are going to learn about how to create an Abstract class using Golang Programming Abstract Class − A restricted class is called an abstract class which cannot be used to create an object from it to access an abstract class, it must be inherited from another class. The Go interface lacks fields and forbids the definition of methods inside of it. Any type must implement every interface method in order to belong to that interface type. There are situations in which having a method's default implementation and default fields in GO is helpful. Let's first grasp ... Read More

Golang Program to Create a Class and Object

Akhil Sharma
Updated on 22-Dec-2022 18:20:37

11K+ Views

In this article we are going to learn how to create class and object. Structs − Go language does not have classes. To create an object in the go programming language we can specify structs and store key-value pairs in it. A struct is a user-defined data type that is used to store data together. The values so stored may have the same or different data type. Syntax The syntax to define a structure is as follows − type name_of_struct struct { name_1 type_1 name_2 type_2 name_3 type_3 ... Read More

Golang Program to Convert Linked list to an Array

Akhil Sharma
Updated on 22-Dec-2022 18:19:36

710 Views

In this article we are going to learn about how to convert linked list to an array using golang program. Linked List − Elements in linked lists are typically not stored in close proximity to one another and their storage structures are less rigid, they must be stored with additional tags that refer to the subsequent element. A linked list is a structure that is created dynamically it has two elements in it one is to store the value and the other is to store the address of the next structure. Array − In arrays elements are stored in contiguous ... Read More

C# Program to Check a HashTable collection is empty or not

Shilpa Nadkarni
Updated on 21-Dec-2022 18:30:37

1K+ Views

The Hashtable collection in C# is a collection of key-value pairs that are organized based on the hash code of the key. The hash code is calculated using a hash code function. Each element in the hashtable is a key-value pair with unique keys. Keys also have to be nonnull. Values can be null and duplicated. In this article, we will discuss how to check if the hashtable collection is empty. How to Check if the Hashtable Collection is Empty? The class in C# that implements the hashtable collection is the Hashtable class. We can check if the hashtable collection ... Read More

What is the difference between Array and NSArray?

Nitin Aggarwal
Updated on 21-Dec-2022 16:27:20

3K+ Views

Since Array and NSArray are both core constructs in iOS development, we sometimes forget just how different they are. Here are some major differences between the two constructs that you should know about. Array is a struct, therefore it is a value type in Swift. NSArray is an immutable Objective C class, therefore it is a reference type in Swift. Array is a Swift construct, and generic struct, which means that it can be an array of any specific type (Int, String, etc.). [T] is syntactic sugar for Array. NSArray is an Objective-C construct that can hold any Objective-C ... Read More

What is an attribute in Swift?

Nitin Aggarwal
Updated on 21-Dec-2022 16:24:40

1K+ Views

Throughout this article, you will learn what an attribute in Swift is and how to use it with code examples. Swift Attributes Swift makes it possible to provide some additional info about the declaration or type. We have two types of attributes that can be used in Swift language. Declaration Attributes Type Attributes Syntax You can apply an attribute by using the symbol @ followed by the attribute name, as shown below − @attribute name @attribute name(attribute arguments) Explanation We can provide arguments in declaration attributes to define the declaration. These arguments can be provided in parentheses ... Read More

What is a Delegate in Swift?

Nitin Aggarwal
Updated on 21-Dec-2022 15:25:33

5K+ Views

In this article, you will learn about what Delegate is and how it works. What is Delegation? As the name implies, delegation gives control to other objects. To make it happen, the delegate object has to be assigned to control other objects. In iOS apps, the UIApplicaitonDelegate is an example. UIApplicationDelegate allows you to modify iOS behavior, such as receiving push notifications, opening URLs, and launching apps. A delegation pattern ensures the functionality that needs to be delegated is provided. Delegate patterns enable objects to communicate back to their owners decoupled from their code. It is much easier to ... Read More

What are the common execution iOS Application Lifecycle?

Nitin Aggarwal
Updated on 21-Dec-2022 15:20:46

1K+ Views

In this article, you will learn about the different execution states of an iOS application. Based on the current state, you can decide what task you want to perform. There are different states that an app might have. The iPhone operating system (iOS) provides us with different five states of an application like the following − Not running Inactive Active Background Suspended An iOS application runs in several states, known as states of the application life cycle. App life cycles are crucial for iOS developers, as they help them understand how their apps behave. The following states are ... Read More

How to write a Multiple-Line Comment in Swift?

Nitin Aggarwal
Updated on 21-Dec-2022 15:12:25

2K+ Views

In this article, we will discuss Swift's comments, why, and how to use them correctly in Swift. Always keep one thing in mind while writing code i.e. The code must be written for people to read and understand as much as possible. Similarly to the Swift language, comments are very useful for making your code more easily understandable to you and other developers. All the comments in the code are completely ignored by the Swift compiler. There are two types of comments in Swift − Single Line Comments Multiline Comments Single Line Comments Syntax Swift allows us to ... Read More

Explain various ways to unwrap an optional in the Swift language

Nitin Aggarwal
Updated on 21-Dec-2022 15:09:06

634 Views

Declaring variables as optional is always recommended and should be the first choice of a developer. You should mark them as optional if they can be invalid (nil or another type). Being developers, we consider it our responsibility to write safe and secure code. To make it possible, Swift provides us with many concepts, and optional is one of them. The optional variable might contain a nil value, so we have to get its value safely. There are a couple of ways to unwrap the value of an optional variable. Let's learn about them. First, we need to understand what ... Read More

Advertisements