+ Start a Discussion

How to call data members from one class to another class?

I have two classes Class1(parent) & Class2 (child)
Public parnent{
public string a;
public string b;
public string c;
}//end of  class 1
Public child{
public string x;
public string y;
public string z;
}//end of class 2
here I want to access a,b,c into child class what is the syntax to call from child to parent class
I tried  below syntax it is throwing an error 
Public class child extends parent

Thanks in advance
Raj VakatiRaj Vakati
the extending class can override the existing virtual methods by using the override keyword in the method definition. Overriding a virtual method allows you to provide a different implementation for an existing method. This means that the behavior of a particular method is different based on the object you’re calling it on. This is referred to as polymorphism.

refer this link 

public virtual class Parent{
    public string x;
    public string y;
    public string z;
}//end of class 2
public class child extends Parent {
    public child(){
}//end of class 2